ftp.nice.ch/Attic/openStep/games/Empire.0.6.m.NIS.bs.tgz#/Empire.0.6/src/EmPlayer.h

This is EmPlayer.h in view mode; [Download] [Up]

//
// $Id: EmPlayer.h,v 1.9 1997/10/31 04:51:45 nygard Exp $
//

//
//  This file is a part of Empire, a game of exploration and conquest.
//  Copyright (C) 1996  Steve Nygard
//
//  This program is free software; you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation; either version 2 of the License, or
//  (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
//  You may contact the author by:
//     e-mail:  nygard@telusplanet.net
//

#import <AppKit/AppKit.h>
#import "Empire.h"

@class City;
@class GameManager;
@class Map;
@class MapView;
@class Unit;

//======================================================================

@interface EmPlayer : NSObject
{
    GameManager *gameManager;

    Player playerNumber;
    NSString *playerName;
    Map *map;

    int productionEfficiency;
    int combatEfficiency;

    NSNumber *savedCookie;

    NSMutableArray *cityList;
    NSMutableArray *unitList;
    NSMutableArray *newUnitList;

    NSMutableArray *unitsAwaitingMovement;
    Unit *selectedUnit;

    // Statistics
    int destroyedUnits[UNIT_TYPE_COUNT];
    int lostUnits[UNIT_TYPE_COUNT];

    // End of game maps.  p_neutral represents the true location of all units.
    Map *finalMaps[4];
    BOOL gameOver;
}

- initWithName:(NSString *)aName number:(Player)number world:(Map *)aMap
       capital:(City *)capitalCity withEfficiencies:(int)pe:(int)ce
   gameManager:(GameManager *)theGameManager;

- (void) dealloc;

//======================================================================
// General data access
//======================================================================

- (GameManager *) gameManager;
- (NSString *) playerName;
- (Player) playerNumber;

- (Map *) map;
- (int) productionEfficiency;
- (int) combatEfficiency;

- (NSArray *) cityList;
- (City *) cityAtLocation:(EMMapLocation)target;
- (City *) ourCityNearestToLocation:(EMMapLocation)target;

- (NSArray *) unitList;
- (NSArray *) newUnitList;

//======================================================================
// Turn phases
//======================================================================

- (void) yourTurn:(int)turn withCookie:(NSNumber *)aCookie;
- (void) yourTurn:(int)turn; // scr
- (void) turnDone;

- (void) initialPhase;

- (void) addUnit:(Unit *)newUnit;
- (void) capturedCity:(City *)aCity;
- (void) lostCity:(City *)aCity;

- (void) updateMapAroundCities;

//======================================================================
// Map Updating
//======================================================================

- (void) unitIconHasChanged:(Unit *)aUnit;
- (void) cityProductionChanged:(City *)aCity;

//======================================================================
// Statistics
//======================================================================

- (WarStatistics) warStatistics;
- (int) cityCount;

//======================================================================
// End of player
//======================================================================

- (BOOL) hasPlayerLost;

- (void) gameStopped:(int)activePlayers;
- (BOOL) playerHasWon:(int)activePlayers;
- (void) playerHasLost:(int)activePlayers;
- (void) playerHasResigned:(int)activePlayers;

- (void) createFinalMaps:(int)activePlayers;

//======================================================================
// Movement
//======================================================================

- (Unit *) nextUnitAwaitingMovement;
- (Unit *) selectedUnit;

- (Unit *) unitWithType:(UnitType)unitType atLocation:(EMMapLocation)target;
- (Unit *) primaryUnitAtLocation:(EMMapLocation)target;

//======================================================================
// Commands
//======================================================================

- (MoveResult) moveSelectedUnitInDirection:(Direction)dir;
- (BOOL) moveResultDidMove:(MoveResult)moveResult;
- (BOOL) tryToMoveSelectedUnitInDirection:(Direction)dir;

- (void) activateThisUnit:(Unit *)aUnit;
- (void) waitUnit:(Unit *)aUnit;

//======================================================================
// Other
//======================================================================

- (void) destroyUnit:(Unit *)aUnit wasDisbanded:(BOOL)disbanded;
- (void) showExplosions:(int)count atLocation:(EMMapLocation)target;

//======================================================================
// Game Resignation
//======================================================================

- (NSArray *) remainingCities;
- (void) aPlayerHasResigned:(Player)number;
- (void) resign;

//======================================================================
// Subclass Responsibilities
//======================================================================

- (void) selectedUnitTriedToMove:(MoveResult)moveResult;

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.