home *** CD-ROM | disk | FTP | other *** search
- //
- // $Id: EmpireProtocols.h,v 1.7 1997/10/31 04:51:49 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 "Empire.h"
-
- @class City;
- @class GameManager;
- @class Map;
-
- //----------------------------------------------------------------------
- // The version should change so that applications with incompatible
- // protocols will not try to communicate.
- //----------------------------------------------------------------------
-
- #define SERVER_PORT_NAME @"Empire Game Server v1"
-
- @protocol EmpireBaseProtocol
- - (void) ping;
- - (void) aboutToDisconnect:(in id)sender; // connection doesn't become invalid until data sent through...
- @end
-
- //======================================================================
-
- @protocol EmpireClientConnectionProtocol <EmpireBaseProtocol>
- - (oneway void) choosePlayer:(Player)number forMap:(bycopy in Map *)worldMap master:(in id)masterGameManager;
- @end
-
- //======================================================================
-
- @protocol EmpireServerConnectionProtocol <EmpireBaseProtocol>
- - (void) client:(in id)clientController onHost:(in NSString *)hostname;
- @end
-
- //======================================================================
-
- @protocol EmpireGameManagerProtocol <EmpireBaseProtocol>
-
- //----------------------------------------------------------------------
- // Game Initialization / Termination
- //----------------------------------------------------------------------
-
- - (bycopy City *) remoteRandomNeutralCity;
- - (oneway void) peer:(in id)ClientGameManager forPlayer:(Player)number;
- - (oneway void) remoteUpdateMapAroundCitiesForPlayer:(Player)number;
-
- - (oneway void) remoteGameHasStopped:(Player)number activePlayers:(int)activePlayers;
-
- - (bycopy Map *) remoteFetchMapForPlayer:(Player)number;
-
- - (oneway void) otherMaps:(in bycopy Map *)map1:(in bycopy Map *)map2 forPlayer:(Player)number;
-
- //----------------------------------------------------------------------
- // Turn Management
- //----------------------------------------------------------------------
-
- - (oneway void) remoteTurn:(int)turn withCookie:(in NSNumber *)aCookie forPlayer:(Player)number;
- - (oneway void) remoteTurnDone:(in NSNumber *)aCookie forPlayer:(Player)number updatedMap:(in bycopy Map *)newMap;
-
- //----------------------------------------------------------------------
- // Combat Support
- //----------------------------------------------------------------------
-
- - (MoveResult) remoteUnitWithCombatProfile:(CombatProfile)attackerProfile
- attacksPlayer:(Player)cityPlayer
- cityAtLocation:(EMMapLocation)target
- playersAdjacentToDefender:(int)adjacentPlayers;
-
- - (MoveResult) remoteUnitWithCombatProfile:(CombatProfile)attackerProfile
- attacksPlayer:(Player)defender
- unitAtLocation:(EMMapLocation)target
- withBombardment:(BOOL)bombarding
- playersAdjacentToDefender:(int)adjacentPlayers;
-
- - (CombatProfile) remoteReadyDefendingCityAtLocation:(EMMapLocation)target forPlayer:(Player)player;
- - (CombatProfile) remoteReadyDefendingUnitAtLocation:(EMMapLocation)target
- forPlayer:(Player)number
- againstBombardment:(BOOL)bombarding;
- - (oneway void) remoteShowExplosions:(int)count forPlayer:(Player)number atLocation:(EMMapLocation)target;
- - (oneway void) remoteHitDefendingUnit:(Player)number withDamage:(int)damage;
- - (bycopy City *) remoteLostDefendingCityOfPlayer:(Player)number;
- - (oneway void) remoteHitAttacker:(Player)number withDamage:(int)damage;
- - (void) remotePlayer:(Player)number hasCapturedCity:(in bycopy City *)capturedCity;
- - (void) remoteFinishedCombatForPlayer:(Player)number;
-
- - (BOOL) remoteCheckForEndOfPlayer:(Player)number;
- - (BOOL) remoteHasPlayerLost:(Player)number;
- - (oneway void) remotePlayerHasLost:(Player)number activePlayers:(int)activePlayers;
- - (BOOL) remotePlayerHasWon:(Player)number activePlayers:(int)activePlayers;
-
- - (oneway void) remoteSet3x3Tokens:(struct NineTokens)tokens aroundLocation:(EMMapLocation)target forPlayer:(Player)number;
- - (oneway void) remoteSetToken:(MapToken)token atLocation:(EMMapLocation)target forPlayer:(Player)number;
-
- - (void) remoteResignPlayerFromGame:(Player)number; // Not oneway
- - (bycopy NSArray *) remoteRemainingCitiesForPlayer:(Player)number;
-
- - (void) remotePlayerHasResigned:(Player)number activePlayers:(int)activePlayers;
-
- - (bycopy Map *) remoteFinalMapForPlayer:(Player)number;
- - (oneway void) remoteNotifyPlayer:(Player)number aPlayerHasResigned:(Player)resignedPlayer;
-
- @end
-
- //======================================================================
-
- @protocol EmpireClientHostNotification
-
- - (void) newClientHost:(NSString *)hostname;
- - (void) removedClientHostNumber:(int)index;
-
- @end
-
- //======================================================================
- // MapView Delegate
- //======================================================================
-
- @protocol MapViewDelegate
-
- - (void) mouseDown:(unsigned int)modifierFlags atLocation:(EMMapLocation)target;
- - (void) mouseUp:(unsigned int)modifierFlags atLocation:(EMMapLocation)target;
- - (void) rightMouseDown:(unsigned int)modifierFlags atLocation:(EMMapLocation)target;
- - (void) rightMouseUp:(unsigned int)modifierFlags atLocation:(EMMapLocation)target;
- - (void) keyDown:(NSEvent *)theEvent;
-
- @end
-