home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / OPENSTEP / Games / Empire-0.6-MIS / EmpireProtocols.h < prev    next >
Encoding:
Text File  |  1997-10-30  |  6.1 KB  |  148 lines

  1. //
  2. // $Id: EmpireProtocols.h,v 1.7 1997/10/31 04:51:49 nygard Exp $
  3. //
  4.  
  5. //
  6. //  This file is a part of Empire, a game of exploration and conquest.
  7. //  Copyright (C) 1996  Steve Nygard
  8. //
  9. //  This program is free software; you can redistribute it and/or modify
  10. //  it under the terms of the GNU General Public License as published by
  11. //  the Free Software Foundation; either version 2 of the License, or
  12. //  (at your option) any later version.
  13. //
  14. //  This program is distributed in the hope that it will be useful,
  15. //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. //  GNU General Public License for more details.
  18. //
  19. //  You should have received a copy of the GNU General Public License
  20. //  along with this program; if not, write to the Free Software
  21. //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. //
  23. //  You may contact the author by:
  24. //     e-mail:  nygard@telusplanet.net
  25. //
  26.  
  27. #import "Empire.h"
  28.  
  29. @class City;
  30. @class GameManager;
  31. @class Map;
  32.  
  33. //----------------------------------------------------------------------
  34. // The version should change so that applications with  incompatible
  35. // protocols will not try to communicate.
  36. //----------------------------------------------------------------------
  37.  
  38. #define SERVER_PORT_NAME @"Empire Game Server v1"
  39.  
  40. @protocol EmpireBaseProtocol
  41. - (void) ping;
  42. - (void) aboutToDisconnect:(in id)sender;  // connection doesn't become invalid until data sent through...
  43. @end
  44.  
  45. //======================================================================
  46.  
  47. @protocol EmpireClientConnectionProtocol <EmpireBaseProtocol>
  48. - (oneway void) choosePlayer:(Player)number forMap:(bycopy in Map *)worldMap master:(in id)masterGameManager;
  49. @end
  50.  
  51. //======================================================================
  52.  
  53. @protocol EmpireServerConnectionProtocol <EmpireBaseProtocol>
  54. - (void) client:(in id)clientController onHost:(in NSString *)hostname;
  55. @end
  56.  
  57. //======================================================================
  58.  
  59. @protocol EmpireGameManagerProtocol <EmpireBaseProtocol>
  60.  
  61. //----------------------------------------------------------------------
  62. // Game Initialization / Termination
  63. //----------------------------------------------------------------------
  64.  
  65. - (bycopy City *) remoteRandomNeutralCity;
  66. - (oneway void) peer:(in id)ClientGameManager forPlayer:(Player)number;
  67. - (oneway void) remoteUpdateMapAroundCitiesForPlayer:(Player)number;
  68.  
  69. - (oneway void) remoteGameHasStopped:(Player)number activePlayers:(int)activePlayers;
  70.  
  71. - (bycopy Map *) remoteFetchMapForPlayer:(Player)number;
  72.  
  73. - (oneway void) otherMaps:(in bycopy Map *)map1:(in bycopy Map *)map2 forPlayer:(Player)number;
  74.  
  75. //----------------------------------------------------------------------
  76. // Turn Management
  77. //----------------------------------------------------------------------
  78.  
  79. - (oneway void) remoteTurn:(int)turn withCookie:(in NSNumber *)aCookie forPlayer:(Player)number;
  80. - (oneway void) remoteTurnDone:(in NSNumber *)aCookie forPlayer:(Player)number updatedMap:(in bycopy Map *)newMap;
  81.  
  82. //----------------------------------------------------------------------
  83. // Combat Support
  84. //----------------------------------------------------------------------
  85.  
  86. - (MoveResult) remoteUnitWithCombatProfile:(CombatProfile)attackerProfile
  87.                              attacksPlayer:(Player)cityPlayer
  88.                             cityAtLocation:(EMMapLocation)target
  89.                  playersAdjacentToDefender:(int)adjacentPlayers;
  90.  
  91. - (MoveResult) remoteUnitWithCombatProfile:(CombatProfile)attackerProfile
  92.                              attacksPlayer:(Player)defender
  93.                             unitAtLocation:(EMMapLocation)target
  94.                            withBombardment:(BOOL)bombarding
  95.                  playersAdjacentToDefender:(int)adjacentPlayers;
  96.  
  97. - (CombatProfile) remoteReadyDefendingCityAtLocation:(EMMapLocation)target forPlayer:(Player)player;
  98. - (CombatProfile) remoteReadyDefendingUnitAtLocation:(EMMapLocation)target
  99.                                            forPlayer:(Player)number
  100.                                   againstBombardment:(BOOL)bombarding;
  101. - (oneway void) remoteShowExplosions:(int)count forPlayer:(Player)number atLocation:(EMMapLocation)target;
  102. - (oneway void) remoteHitDefendingUnit:(Player)number withDamage:(int)damage;
  103. - (bycopy City *) remoteLostDefendingCityOfPlayer:(Player)number;
  104. - (oneway void) remoteHitAttacker:(Player)number withDamage:(int)damage;
  105. - (void) remotePlayer:(Player)number hasCapturedCity:(in bycopy City *)capturedCity;
  106. - (void) remoteFinishedCombatForPlayer:(Player)number;
  107.  
  108. - (BOOL) remoteCheckForEndOfPlayer:(Player)number;
  109. - (BOOL) remoteHasPlayerLost:(Player)number;
  110. - (oneway void) remotePlayerHasLost:(Player)number activePlayers:(int)activePlayers;
  111. - (BOOL) remotePlayerHasWon:(Player)number activePlayers:(int)activePlayers;
  112.  
  113. - (oneway void) remoteSet3x3Tokens:(struct NineTokens)tokens aroundLocation:(EMMapLocation)target forPlayer:(Player)number;
  114. - (oneway void) remoteSetToken:(MapToken)token atLocation:(EMMapLocation)target forPlayer:(Player)number;
  115.  
  116. - (void) remoteResignPlayerFromGame:(Player)number; // Not oneway
  117. - (bycopy NSArray *) remoteRemainingCitiesForPlayer:(Player)number;
  118.  
  119. - (void) remotePlayerHasResigned:(Player)number activePlayers:(int)activePlayers;
  120.  
  121. - (bycopy Map *) remoteFinalMapForPlayer:(Player)number;
  122. - (oneway void) remoteNotifyPlayer:(Player)number aPlayerHasResigned:(Player)resignedPlayer;
  123.  
  124. @end
  125.  
  126. //======================================================================
  127.  
  128. @protocol EmpireClientHostNotification
  129.  
  130. - (void) newClientHost:(NSString *)hostname;
  131. - (void) removedClientHostNumber:(int)index;
  132.  
  133. @end
  134.  
  135. //======================================================================
  136. // MapView Delegate
  137. //======================================================================
  138.  
  139. @protocol MapViewDelegate
  140.  
  141. - (void) mouseDown:(unsigned int)modifierFlags atLocation:(EMMapLocation)target;
  142. - (void) mouseUp:(unsigned int)modifierFlags atLocation:(EMMapLocation)target;
  143. - (void) rightMouseDown:(unsigned int)modifierFlags atLocation:(EMMapLocation)target;
  144. - (void) rightMouseUp:(unsigned int)modifierFlags atLocation:(EMMapLocation)target;
  145. - (void) keyDown:(NSEvent *)theEvent;
  146.  
  147. @end
  148.