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

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

//
// $Id: EditorController.h,v 1.9 1997/10/23 02:25:36 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"
#import "EmpireProtocols.h" // For MapViewDelegate, which should be replaced by NSNotificationCenter stuff.

typedef enum _SaveMode
{
    sm_save,
    sm_save_as,
    sm_save_to
} SaveMode;

@class Map;
@class MapView;
@class SNRandom;
@class WorldMapController;

@interface EditorController : NSObject <MapViewDelegate>
{
    IBOutlet NSWindow *mapEditorWindow;
    IBOutlet NSWindow *newMapPanel;
    IBOutlet MapView *mapView;
    WorldMapController *worldMapController;

    IBOutlet NSTextField *widthTextfield;
    IBOutlet NSTextField *heightTextfield;

    Map *map;
    NSString *mapName;

    int brushType;
    MapToken tokenType;

    IBOutlet NSTextField *islandCountTextfield;
    IBOutlet NSTextField *minimumSizeTextfield;
    IBOutlet NSTextField *maximumSizeTextfield;
    IBOutlet NSTextField *buildTypeMatrix;

    IBOutlet NSTableView *terrainSummaryTableview;

    int terrainCounts[4];

    NSString *lastDirectory;
    SNRandom *rng;
}

- (void) awakeFromNib;
- init;
- (void) dealloc;

- (Map *) map;
- (void) setMap:(Map *)newMap;

- (void) takeBrushTypeFrom:sender;
- (void) takeTokenTypeFrom:sender;

- (BOOL) validateMenuItem:(NSMenuItem *)menuCell;

- (void) showWorldMap:sender;
- (void) newMapStopAction:sender;
- (void) okayAction:sender;

- (void) takeLastDirectoryFromSavePanel:(NSSavePanel *)savePanel;

- (void) newMap;

- (void) open:sender;
- (void) save:sender;
- (void) saveAs:sender;
- (void) saveTo:sender;
- (BOOL) saveMode:(SaveMode)sm;

- (void) growTerrain:(MapToken)token fromLocation:(EMMapLocation)source toLocation:(EMMapLocation)target;
- (void) branchTerrain:(MapToken)token fromLocation:(EMMapLocation)source toLocation:(EMMapLocation)target;

- (void) growTerrain:(MapToken)token fromLocation:(EMMapLocation)source;
- (void) branchTerrain:(MapToken)token fromLocation:(EMMapLocation)source;

- (BOOL) location:(EMMapLocation)target adjacentToTerrain:(Terrain)terrain;

- (void) clearToCurrent:sender;

- (void) suspendMainMapUpdate;
- (void) resumeMainMapUpdate;

//======================================================================
// Build World
//======================================================================

- (void) recalculateTerrainDistribution:sender;
- (void) build:sender;

- (void) clearSingleTerrains:sender;
- (EMMapLocation) meanderFromLocation:(EMMapLocation)location
                   lastDirectionIndex:(int *)lastIndex
                               origin:(EMMapLocation)origin
                                 size:(EMMapSize)size;
- (EMMapLocation) meanderFromLocation:(EMMapLocation)location lastDirectionIndex:(int *)lastIndex;
- (void) meander:sender;

- (int) numberOfRowsInTableView:(NSTableView *)aTableView;
- tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex;

//======================================================================
// 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;

//======================================================================
// WindowDelegate
//======================================================================

- (void) windowDidBecomeKey:(NSNotification *)notification;
- (void) windowDidResignKey:(NSNotification *)notification;
  
- (void) windowWillMiniaturize:(NSNotification *)notification;
- (void) windowDidDeminiaturize:(NSNotification *)notification;

@end

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