/Volumes/Plantain/MyDocuments/Projects/MacTrek/MacTrek/Data/Planet.m

00001 //
00002 //  Planet.m
00003 //  MacTrek
00004 //
00005 //  Created by Aqua on 23/04/2006.
00006 //  Copyright 2006 __MyCompanyName__. All rights reserved.
00007 //
00008 
00009 #import "Planet.h"
00010 
00011 @implementation Planet
00012 
00013 - (id) init {
00014     self = [super init];
00015     if (self != nil) {
00016         flags = 0;                                                      // State information
00017         owner = nil;
00018         name = @"??";
00019         position.x = -1000;
00020         position.y = -1000;
00021         name = @"??";
00022         armies = 0;
00023         info = 0;                                                       // Teams which have info on planets    
00024         orbit = 0;
00025         planetId = -1;
00026     }
00027     return self;
00028 }
00029 
00030 - (id)initWithPlanetId:(int)id {
00031     self = [self init];
00032     if (self != nil) {
00033         planetId = id;
00034     }
00035     return self;
00036 }
00037 
00038 - (int)planetId {
00039     return planetId;
00040 }
00041 
00042 - (NSString*) name {
00043     return name;
00044 }
00045 
00046 - (NSString*) abbreviation {
00047     if ([name length] > 3) {
00048         return [[name substringWithRange:NSMakeRange(0,3)] uppercaseString];
00049     }
00050     return name;
00051 }
00052 
00053 - (bool) needsDisplay {
00054     return needsDisplay;
00055 }
00056 
00057 - (Team*) owner {
00058     return owner;
00059 }
00060 
00061 - (void) setOwner: (Team*) team {
00062     owner = team;
00063 }
00064 
00065 - (int)  info {
00066     return info;
00067 }
00068 
00069 - (void) setInfo: (int) newInfo {
00070     info = newInfo;
00071 }               
00072 
00073 - (int)  flags {
00074     return flags;
00075 }
00076 
00077 - (int)  armies {
00078     return armies;
00079 }
00080 
00081 - (void) setName:(NSString *)newName {
00082     [name release];
00083     name = newName;
00084     [name retain];
00085 }
00086 
00087 - (void) setFlags: (int) newFlags {
00088     flags = newFlags;
00089 }
00090 
00091 - (void) setArmies: (int) newArmies {
00092     armies = newArmies;
00093 }
00094 
00095 - (void) setNeedsDisplay: (bool) redraw {
00096     needsDisplay = redraw;
00097 }
00098 
00099 // fixed size 1200 by 1200 game pix (30x30 view pix)
00100 - (NSSize) size {
00101     return NSMakeSize(1200, 1200);
00102 }
00103 
00104 @end

Generated on Fri Jul 28 19:15:16 2006 for MacTrek by  doxygen 1.4.7