Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

source/simulation.h

Go to the documentation of this file.
00001 
00004 #if !defined(_SIMULATION_H_)
00005 #define _SIMULATION_H_
00006 
00007 #if defined(__cplusplus)
00008 extern "C" {
00009 #endif
00010 
00012 typedef enum {
00013         bnResidential = 0,
00014         bnCommercial,
00015         bnIndustrial,
00016         bnIncome,
00017         bnTraffic,
00018         bnPower,
00019         bnDefence,
00020         bnCurrentBalance,
00021         bnChange,
00022         bnNextMonth
00023 } BudgetNumber;
00024 
00026 #define POWEREDBIT      ((unsigned char)0x01)
00027 
00028 #define WATEREDBIT      ((unsigned char)0x02)
00029 
00030 #define SAVEDBITS       (2)
00031 
00033 #define SCRATCHBIT      ((unsigned char)0x80)
00034 
00035 #define PAINTEDBIT      ((unsigned char)0x40)
00036 
00037 #include <zakdef.h>
00038 #include <compilerpragmas.h>
00039 
00045 EXPORT Int16 Sim_DoPhase(Int16 nPhase);
00046 
00052 EXPORT Int32 BudgetGetNumber(BudgetNumber type);
00053 
00059 EXPORT void UpdateVolatiles(void);
00060 
00066 EXPORT void UpdateCounters(void);
00067 
00071 void RecordStatistics(void);
00072 
00077 EXPORT UInt32 getPopulation(void);
00078 
00084 EXPORT Int16 IsRoad(welem_t x);
00085 
00091 EXPORT Int16 IsRoadPower(welem_t x);
00092 
00098 EXPORT Int16 IsRoadPipe(welem_t x);
00099 
00105 EXPORT Int16 IsRoadBridge(welem_t x);
00106 
00112 EXPORT Int16 IsRoadOrBridge(welem_t x);
00113 
00119 EXPORT Int16 IsRail(welem_t x);
00120 
00126 EXPORT Int16 IsRailPower(welem_t x);
00127 
00133 EXPORT Int16 IsRailPipe(welem_t x);
00134 
00140 EXPORT Int16 IsRailTunnel(welem_t x);
00141 
00147 EXPORT Int16 IsRailOrTunnel(welem_t x);
00148 
00154 EXPORT Int16 IsRailOvRoad(welem_t x);
00155 
00161 EXPORT Int16 IsPowerWater(welem_t x);
00162 
00168 EXPORT Int16 ZoneValue(welem_t x);
00169 
00175 EXPORT Int16 IsPowerLine(welem_t x);
00176 
00182 EXPORT Int16 IsWaterPipe(welem_t x);
00183 
00190 EXPORT Int16 IsZone(welem_t x, zoneType nType);
00191 
00196 EXPORT Int16 IsOccupied(welem_t x);
00197 
00205 EXPORT Int16 IsTransport(welem_t x);
00206 
00212 #define IsRealWater(X)  ((X) == Z_REALWATER)
00213 
00219 #define IsPump(X) ((X) == Z_PUMP)
00220 
00226 #define IsCoalPlant(X)  (((X) >= Z_COALPLANT_START) && ((X) <= Z_COALPLANT_END))
00227 
00233 #define IsNukePlant(X)  (((X) >= Z_NUCLEARPLANT_START) && \
00234     ((X) <= Z_NUCLEARPLANT_END))
00235 
00236 /*
00237  * \brief is the node a real tree
00238  * \param X the node to test
00239  * \return true if it is a real tree
00240  */
00241 #define IsRealTree(X)   ((X) == Z_REALTREE)
00242 
00248 #define IsFakeTree(X)   ((X) == Z_FAKETREE)
00249 
00255 #define IsTree(X)       (IsFakeTree(X) || IsRealTree(X))
00256 
00262 #define IsRealWater(X)  ((X) == Z_REALWATER)
00263 
00269 #define IsFakeWater(X)  ((X) == Z_FAKEWATER)
00270 
00276 #define IsWater(X)      (IsFakeWater(X) || IsRealWater(X))
00277 
00283 #define IsSlum(X) (((X) >= Z_COMMERCIAL_SLUM) && ((X) <= Z_INDUSTRIAL_SLUM))
00284 
00290 #define IsGrowable(X) (IsSlum(X) || \
00291     (((X) >= Z_COMMERCIAL_MIN) && ((X) <= Z_INDUSTRIAL_MAX)))
00292 
00298 #define IsCommercial(X) (((X) == Z_COMMERCIAL_SLUM) || \
00299     (((X) >= Z_COMMERCIAL_MIN) && ((X) <= Z_COMMERCIAL_MAX)))
00300 
00306 #define IsResidential(X)        (((X) == Z_RESIDENTIAL_SLUM) || \
00307     (((X) >= Z_RESIDENTIAL_MIN) && ((X) <= Z_RESIDENTIAL_MAX)))
00308 
00314 #define IsIndustrial(X) (((X) == Z_INDUSTRIAL_SLUM) || \
00315     (((X) >= Z_INDUSTRIAL_MIN) && ((X) <= Z_INDUSTRIAL_MAX)))
00316 
00322 #define IsWaste(X)      ((X) == Z_WASTE)
00323 
00329 #define IsFireStation(X)        (((X) >= Z_FIRESTATION_START) && \
00330     ((X) <= Z_FIRESTATION_END))
00331 
00337 #define IsPoliceDept(X) (((X) >= Z_POLICEDEPT_START) && \
00338     ((X) <= Z_POLICEDEPT_END))
00339 
00345 #define IsArmyBase(X)   (((X) >= Z_ARMYBASE_START) && \
00346     ((X) <= Z_ARMYBASE_END))
00347 
00348 #define DIR_UP          (1<<0)
00349 #define DIR_DOWN        (1<<1)
00350 #define DIR_VER         ((DIR_UP) | (DIR_DOWN))
00351 #define DIR_LEFT        (1<<2)
00352 #define DIR_RIGHT       (1<<3)
00353 #define DIR_HOR         ((DIR_LEFT) | (DIR_RIGHT))
00354 #define DIR_ALL         ((DIR_HOR) | (DIR_VER))
00355 
00356 typedef Int16 (*carryfn_t)(welem_t);
00357 typedef Int16 (*carryfnarg_t)(welem_t, void *);
00358 
00366 EXPORT UInt8 CheckNextTo(UInt32 pos, UInt8 dirs, carryfn_t checkfn);
00367 
00376 EXPORT UInt8 CheckNextTo1(UInt32 pos, UInt8 dirs, carryfnarg_t checkfn,
00377     void *cfarg);
00378 
00384 EXPORT Int16 CarryPower(welem_t x);
00385 
00391 EXPORT Int16 CarryWater(welem_t x);
00392 
00393 /*
00394  * \brief End the simulation, free any memory that's in use
00395  */
00396 void endSimulation(void);
00397 
00398 #if defined(__cplusplus)
00399 }
00400 #endif
00401 
00402 #define getScratch(i) (getWorldFlags(i) & SCRATCHBIT)
00403 #define setScratch(i) orWorldFlags((i), SCRATCHBIT)
00404 #define unsetScratch(i) andWorldFlags((i), (selem_t)~SCRATCHBIT)
00405 #define clearScratch() { \
00406         UInt32 XXX = 0; \
00407         for (; XXX < MapMul(); XXX++) unsetScratch(XXX); \
00408 }
00409 
00410 #endif /* _SIMULATION_H_ */

Generated on Mon Aug 30 19:44:17 2004 for pocketcity by doxygen1.2.18