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

  1. //
  2. // $Id: Map.h,v 1.4 1997/10/28 02:58:07 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 <AppKit/AppKit.h>
  28. #import <Foundation/NSPortCoder.h>
  29. #import "Empire.h"
  30.  
  31. //======================================================================
  32.  
  33. @protocol MapDelegate
  34.  
  35. - (void) refreshLocation:(EMMapLocation)target;
  36. - (void) refresh3x3Location:(EMMapLocation)target;
  37.  
  38. @end
  39.  
  40. //======================================================================
  41.  
  42. @interface Map : NSObject <NSCopying, NSCoding, MapDelegate>
  43. {
  44.     EMMapSize mapSize;
  45.  
  46.     MapToken *mapData;
  47.     MapToken **mapPointers;
  48.  
  49.     NSMutableArray *observers;
  50. }
  51.  
  52. - initMapWithSize:(EMMapSize)size;
  53. - (void) dealloc;
  54.  
  55. - copyWithZone:(NSZone *)zone;
  56. - (void) encodeWithCoder:(NSCoder *)aCoder;
  57. - initWithCoder:(NSCoder *)aDecoder;
  58.  
  59. - replacementObjectForPortCoder:(NSPortCoder *)encoder;
  60.  
  61. - (EMMapSize) mapSize;
  62. - (int) percentExplored;
  63.  
  64. // Special access:
  65. - (MapToken *) mapData;
  66. - (MapToken **) mapPtrs;
  67.  
  68. - (MapToken) tokenAtLocation:(EMMapLocation)target;
  69. - (void) get3x3Tokens:(MapToken *)tokens aroundLocation:(EMMapLocation)target;
  70. - (void) get5x5Tokens:(MapToken *)tokens aroundLocation:(EMMapLocation)target;
  71.  
  72. - (void) setToken:(MapToken)token atLocation:(EMMapLocation)target;
  73. - (void) set3x3Tokens:(MapToken *)tokens aroundLocation:(EMMapLocation)target;
  74. - (void) set3x3TokensTo:(MapToken)token aroundLocation:(EMMapLocation)target;
  75.  
  76. - (void) put:(Player)player:(Icon)icon atLocation:(EMMapLocation)target;
  77. - (void) remove:(Icon)icon atLocation:(EMMapLocation)target;
  78. - (void) setCityAtLocation:(EMMapLocation)target toPlayer:(Player)number;
  79.  
  80. - (void) clearMapTo:(MapToken)token;
  81. - (void) setMapExplored:(BOOL)isExplored;
  82. - (void) stripIcons;
  83. - (void) stripIconsOfPlayer:(Player)number;
  84.  
  85. - (int) countTerrainType:(Terrain)terrain;
  86.  
  87. - (void) explore3x3AroundLocation:(EMMapLocation)target;
  88.  
  89. //======================================================================
  90. // Observer Pattern
  91. //======================================================================
  92.  
  93. - (void) refreshMap;
  94. - (void) refreshLocation:(EMMapLocation)target;
  95. - (void) refresh3x3Location:(EMMapLocation)target;
  96. - (void) strippedIconsOfPlayer:(Player)number;
  97.  
  98. - (void) attach:observer;
  99. - (void) detach:observer;
  100.  
  101. @end
  102.