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

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

//
// $Id: Map.h,v 1.4 1997/10/28 02:58:07 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 <Foundation/NSPortCoder.h>
#import "Empire.h"

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

@protocol MapDelegate

- (void) refreshLocation:(EMMapLocation)target;
- (void) refresh3x3Location:(EMMapLocation)target;

@end

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

@interface Map : NSObject <NSCopying, NSCoding, MapDelegate>
{
    EMMapSize mapSize;

    MapToken *mapData;
    MapToken **mapPointers;

    NSMutableArray *observers;
}

- initMapWithSize:(EMMapSize)size;
- (void) dealloc;

- copyWithZone:(NSZone *)zone;
- (void) encodeWithCoder:(NSCoder *)aCoder;
- initWithCoder:(NSCoder *)aDecoder;

- replacementObjectForPortCoder:(NSPortCoder *)encoder;

- (EMMapSize) mapSize;
- (int) percentExplored;

// Special access:
- (MapToken *) mapData;
- (MapToken **) mapPtrs;

- (MapToken) tokenAtLocation:(EMMapLocation)target;
- (void) get3x3Tokens:(MapToken *)tokens aroundLocation:(EMMapLocation)target;
- (void) get5x5Tokens:(MapToken *)tokens aroundLocation:(EMMapLocation)target;

- (void) setToken:(MapToken)token atLocation:(EMMapLocation)target;
- (void) set3x3Tokens:(MapToken *)tokens aroundLocation:(EMMapLocation)target;
- (void) set3x3TokensTo:(MapToken)token aroundLocation:(EMMapLocation)target;

- (void) put:(Player)player:(Icon)icon atLocation:(EMMapLocation)target;
- (void) remove:(Icon)icon atLocation:(EMMapLocation)target;
- (void) setCityAtLocation:(EMMapLocation)target toPlayer:(Player)number;

- (void) clearMapTo:(MapToken)token;
- (void) setMapExplored:(BOOL)isExplored;
- (void) stripIcons;
- (void) stripIconsOfPlayer:(Player)number;

- (int) countTerrainType:(Terrain)terrain;

- (void) explore3x3AroundLocation:(EMMapLocation)target;

//======================================================================
// Observer Pattern
//======================================================================

- (void) refreshMap;
- (void) refreshLocation:(EMMapLocation)target;
- (void) refresh3x3Location:(EMMapLocation)target;
- (void) strippedIconsOfPlayer:(Player)number;

- (void) attach:observer;
- (void) detach:observer;

@end

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