#include <zakdef.h>
#include <compilerpragmas.h>
Go to the source code of this file.
Defines | |
#define | POWEREDBIT ((unsigned char)0x01) |
the bit associated with power in the worldflags | |
#define | WATEREDBIT ((unsigned char)0x02) |
the bit associated with water in the worldflags | |
#define | SAVEDBITS (2) |
the number of fits saved into the savegame | |
#define | SCRATCHBIT ((unsigned char)0x80) |
the bit associated with scratch/unvisited in the worldflags | |
#define | PAINTEDBIT ((unsigned char)0x40) |
the bit associated with knowing if the field has been painted | |
#define | IsRealWater(X) ((X) == Z_REALWATER) |
is this zone real water | |
#define | IsPump(X) ((X) == Z_PUMP) |
Is the node a pump. | |
#define | IsCoalPlant(X) (((X) >= Z_COALPLANT_START) && ((X) <= Z_COALPLANT_END)) |
is the node a coal power plant | |
#define | IsNukePlant(X) |
is the node a nuclear power pland | |
#define | IsFakeTree(X) ((X) == Z_FAKETREE) |
is the node a fake tree | |
#define | IsTree(X) (IsFakeTree(X) || IsRealTree(X)) |
is the node a tree (fake or real) | |
#define | IsRealWater(X) ((X) == Z_REALWATER) |
is this zone real water | |
#define | IsFakeWater(X) ((X) == Z_FAKEWATER) |
is the node fake water | |
#define | IsWater(X) (IsFakeWater(X) || IsRealWater(X)) |
is the node water | |
#define | IsSlum(X) (((X) >= Z_COMMERCIAL_SLUM) && ((X) <= Z_INDUSTRIAL_SLUM)) |
is the node a slum | |
#define | IsGrowable(X) |
Is a zone 'growable'. | |
#define | IsCommercial(X) |
is the zone a Commercial one | |
#define | IsResidential(X) |
is the zone a Residential one | |
#define | IsIndustrial(X) |
is the zone an Industrial one | |
#define | IsWaste(X) ((X) == Z_WASTE) |
is the node wasteland | |
#define | IsFireStation(X) |
is the zone any of the 'fire station' nodes | |
#define | IsPoliceDept(X) |
is the zone any of the 'police department' nodes | |
#define | IsArmyBase(X) |
is the zone any of the 'army base' nodes | |
Enumerations | |
enum | BudgetNumber |
budget numbers that are obtained for reporting | |
Functions | |
EXPORT Int16 | Sim_DoPhase (Int16 nPhase) |
Perform a phase of the simulation. | |
EXPORT Int32 | BudgetGetNumber (BudgetNumber type) |
Get a number for the budget. | |
EXPORT void | UpdateVolatiles (void) |
update the vgame entries | |
EXPORT void | UpdateCounters (void) |
Update the various counter entities for the statistics. | |
void | RecordStatistics (void) |
record all the statistics for the month. | |
EXPORT UInt32 | getPopulation (void) |
get the population of the simulation | |
EXPORT Int16 | IsRoad (welem_t x) |
Is this node a road. | |
EXPORT Int16 | IsRoadPower (welem_t x) |
is the node a road overlapping with power | |
EXPORT Int16 | IsRoadPipe (welem_t x) |
is the node a road overlapping with power | |
EXPORT Int16 | IsRoadBridge (welem_t x) |
is this node a bridge | |
EXPORT Int16 | IsRoadOrBridge (welem_t x) |
is the zone either a road or bridge | |
EXPORT Int16 | IsRail (welem_t x) |
is the node Rail | |
EXPORT Int16 | IsRailPower (welem_t x) |
is the node rail overlapping power | |
EXPORT Int16 | IsRailPipe (welem_t x) |
is the node rail overlapping with a pipe | |
EXPORT Int16 | IsRailTunnel (welem_t x) |
is the node a rail tunnel | |
EXPORT Int16 | IsRailOrTunnel (welem_t x) |
is the node a rail line or a tunnel | |
EXPORT Int16 | IsRailOvRoad (welem_t x) |
is the node a rail track overlapping with a road | |
EXPORT Int16 | IsPowerWater (welem_t x) |
is the node a power overlapping with water pipe | |
EXPORT Int16 | ZoneValue (welem_t x) |
get the value of the zone | |
EXPORT Int16 | IsPowerLine (welem_t x) |
Is this node a power line. | |
EXPORT Int16 | IsWaterPipe (welem_t x) |
is this node a water pipe | |
EXPORT Int16 | IsZone (welem_t x, zoneType nType) |
Is this node of the zone type passed in. | |
EXPORT Int16 | IsOccupied (welem_t x) |
is this zone occupied | |
EXPORT Int16 | IsTransport (welem_t x) |
Is this node a transportation node? | |
EXPORT UInt8 | CheckNextTo (UInt32 pos, UInt8 dirs, carryfn_t checkfn) |
Is one of the zones in the direction passed of the type passed. | |
EXPORT UInt8 | CheckNextTo1 (UInt32 pos, UInt8 dirs, carryfnarg_t checkfn, void *cfarg) |
check if one of the zones around it is of a certain type. | |
EXPORT Int16 | CarryPower (welem_t x) |
Can the node carry power. | |
EXPORT Int16 | CarryWater (welem_t x) |
can the node carry water. |
Definition in file simulation.h.
|
Value: Definition at line 405 of file simulation.h. |
|
Value: (((X) >= Z_ARMYBASE_START) && \ ((X) <= Z_ARMYBASE_END))
Definition at line 345 of file simulation.h. Referenced by Build_Destroy(). |
|
is the node a coal power plant
Definition at line 226 of file simulation.h. Referenced by Build_Destroy(), and GetScoreFor(). |
|
Value: (((X) == Z_COMMERCIAL_SLUM) || \ (((X) >= Z_COMMERCIAL_MIN) && ((X) <= Z_COMMERCIAL_MAX)))
Definition at line 298 of file simulation.h. Referenced by Build_Destroy(), DowngradeZone(), and UpdateVolatiles(). |
|
is the node a fake tree
Definition at line 248 of file simulation.h. Referenced by Build_Destroy(), GetScoreFor(), and UpdateVolatiles(). |
|
is the node fake water
Definition at line 269 of file simulation.h. Referenced by Build_Destroy(), GetScoreFor(), and UpdateVolatiles(). |
|
Value: (((X) >= Z_FIRESTATION_START) && \ ((X) <= Z_FIRESTATION_END))
Definition at line 329 of file simulation.h. Referenced by Build_Destroy(). |
|
Value: (IsSlum(X) || \ (((X) >= Z_COMMERCIAL_MIN) && ((X) <= Z_INDUSTRIAL_MAX)))
Definition at line 290 of file simulation.h. Referenced by GetRandomZone(). |
|
Value: (((X) == Z_INDUSTRIAL_SLUM) || \ (((X) >= Z_INDUSTRIAL_MIN) && ((X) <= Z_INDUSTRIAL_MAX)))
Definition at line 314 of file simulation.h. Referenced by Build_Destroy(), DowngradeZone(), and UpdateVolatiles(). |
|
Value: (((X) >= Z_NUCLEARPLANT_START) && \ ((X) <= Z_NUCLEARPLANT_END))
Definition at line 233 of file simulation.h. Referenced by Build_Destroy(), and GetScoreFor(). |
|
Value: (((X) >= Z_POLICEDEPT_START) && \ ((X) <= Z_POLICEDEPT_END))
Definition at line 337 of file simulation.h. Referenced by Build_Destroy(). |
|
Is the node a pump.
Definition at line 219 of file simulation.h. Referenced by Build_Destroy(), CarryPower(), CarryWater(), and UpdateVolatiles(). |
|
is this zone real water
Definition at line 262 of file simulation.h. |
|
is this zone real water
Definition at line 262 of file simulation.h. Referenced by Build_Destroy(), Build_Rail(), Build_Road(), and GetScoreFor(). |
|
Value: (((X) == Z_RESIDENTIAL_SLUM) || \ (((X) >= Z_RESIDENTIAL_MIN) && ((X) <= Z_RESIDENTIAL_MAX)))
Definition at line 306 of file simulation.h. Referenced by Build_Destroy(), DowngradeZone(), and UpdateVolatiles(). |
|
is the node a slum
Definition at line 283 of file simulation.h. Referenced by GetZoneScore(). |
|
is the node a tree (fake or real)
Definition at line 255 of file simulation.h. |
|
is the node wasteland
Definition at line 322 of file simulation.h. Referenced by Build_Destroy(). |
|
is the node water
Definition at line 276 of file simulation.h. |
|
Get a number for the budget.
Definition at line 983 of file simulation.c. References bc_coalplants, bc_count_roads, bc_fire_stations, bc_military_bases, bc_nuclearplants, bc_police_departments, bc_powerlines, bc_value_commercial, bc_value_industrial, bc_value_residential, BudgetNumber, costIt(), Int32, ue_defense, ue_power, and ue_traffic. Referenced by budget_defence(), budget_power(), budget_traffic(), budgetSetup(), DoTaxes(), DoUpkeep(), UIUpdateBudget(), and updateBudgetNumber(). |
|
Can the node carry power. This works this way because all the nodes that carry water are in sequence Definition at line 1318 of file simulation.c. References IsPump, IsRailPower(), and welem_t. Referenced by DoDistribute(), DrawFieldWithoutInit(), hoverUpdate(), and querySetup(). |
|
can the node carry water. This is slightly more complicated because the nodes that carry water are not in the same order as the nodes that carry power. This is the tradeoff that has to be made. One is faster at the expense of the other. Definition at line 1339 of file simulation.c. References IsPump, IsRailPipe(), IsRoadPipe(), IsWaterPipe(), and welem_t. Referenced by DoDistribute(), DrawFieldWithoutInit(), hoverUpdate(), and querySetup(). |
|
Is one of the zones in the direction passed of the type passed.
Referenced by Build_Rail(), and Build_Road(). |
|
check if one of the zones around it is of a certain type.
Definition at line 1495 of file simulation.c. References getMapWidth, getWorld(), MapMul, UInt32, and UInt8. |
|
get the population of the simulation
Definition at line 1307 of file simulation.c. References bc_value_commercial, bc_value_industrial, and bc_value_residential. Referenced by UIDrawPop(), and UIPaintPopulation(). |
|
is this zone occupied
Definition at line 1469 of file simulation.c. References welem_t. |
|
Is this node a power line.
Definition at line 1347 of file simulation.c. References welem_t. Referenced by Build_Destroy(), Build_Rail(), Build_Road(), Build_WaterPipe(), DoCommitmentNasties(), GetGraphicNumber(), and UpdateVolatiles(). |
|
is the node a power overlapping with water pipe
Definition at line 1399 of file simulation.c. References welem_t. Referenced by Build_Destroy(), DoCommitmentNasties(), and UpdateVolatiles(). |
|
is the node Rail
Definition at line 1433 of file simulation.c. References welem_t. Referenced by Build_Destroy(), Build_PowerLine(), Build_Road(), Build_WaterPipe(), GetGraphicNumber(), IsRailOrTunnel(), IsTransport(), and ZoneValue(). |
|
is the node a rail line or a tunnel
Definition at line 1457 of file simulation.c. References IsRail(), IsRailTunnel(), and welem_t. |
|
is the node a rail track overlapping with a road
Definition at line 1463 of file simulation.c. References welem_t. Referenced by Build_Destroy(), and IsTransport(). |
|
is the node rail overlapping with a pipe
Definition at line 1445 of file simulation.c. References welem_t. Referenced by Build_Destroy(), CarryWater(), and IsTransport(). |
|
is the node rail overlapping power
Definition at line 1439 of file simulation.c. References welem_t. Referenced by Build_Destroy(), CarryPower(), and IsTransport(). |
|
is the node a rail tunnel
Definition at line 1451 of file simulation.c. References welem_t. Referenced by Build_Destroy(), IsRailOrTunnel(), and IsTransport(). |
|
Is this node a road.
Definition at line 1353 of file simulation.c. References welem_t. Referenced by Build_Destroy(), Build_Generic(), Build_PowerLine(), Build_Rail(), Build_WaterPipe(), GetGraphicNumber(), GetScoreFor(), GetZoneScore(), IsRoadOrBridge(), IsTransport(), UpdateVolatiles(), and ZoneValue(). |
|
is this node a bridge
Definition at line 1359 of file simulation.c. References welem_t. Referenced by Build_Destroy(), CreateWaste(), IsRoadOrBridge(), and IsTransport(). |
|
is the zone either a road or bridge
Definition at line 1427 of file simulation.c. References IsRoad(), IsRoadBridge(), and welem_t. |
|
is the node a road overlapping with power
Definition at line 1387 of file simulation.c. References welem_t. Referenced by Build_Destroy(), CarryWater(), IsTransport(), and UpdateVolatiles(). |
|
is the node a road overlapping with power
Definition at line 1393 of file simulation.c. References welem_t. Referenced by Build_Destroy(), IsTransport(), and UpdateVolatiles(). |
|
Is this node a transportation node?
Definition at line 1418 of file simulation.c. References IsRail(), IsRailOvRoad(), IsRailPipe(), IsRailPower(), IsRailTunnel(), IsRoad(), IsRoadBridge(), IsRoadPipe(), IsRoadPower(), and welem_t. Referenced by DoCommitmentNasties(). |
|
is this node a water pipe
Definition at line 1365 of file simulation.c. References welem_t. Referenced by Build_Destroy(), Build_PowerLine(), Build_Rail(), Build_Road(), CarryWater(), DoCommitmentNasties(), GetGraphicNumber(), and UpdateVolatiles(). |
|
Is this node of the zone type passed in.
Definition at line 1405 of file simulation.c. References welem_t, and zoneType. Referenced by GetScoreFor(), and GetZoneScore(). |
|
record all the statistics for the month. This involves compositing the month delta into the graph. This is done by taking the old average; multiplying it by 3, adding the current month's value and dividing by 4. We have to be careful of overflow. Definition at line 1274 of file simulation.c. References BuildCount, getMonthsElapsed, _history::last_ten, ShuffleIndividualStatistic(), st_cashflow, st_tail, StatisticItem, UInt16, and UInt32. |
|
Perform a phase of the simulation.
Definition at line 1077 of file simulation.c. References addGraphicUpdate(), ClearUpdate, DoRandomDisaster(), DoTaxes(), DoUpkeep(), FindScoreForZones(), FindZonesForUpgrading(), GRID_POWER, GRID_WATER, gu_credits, gu_desires, gu_population, Int16, NeedsUpdate, reGradeZones(), Sim_Distribute_Specific(), and UICheckMoney(). Referenced by mainloop_callback(). |
|
Update the various counter entities for the statistics. This updates the various fields that are not recorded directly in the system Definition at line 1235 of file simulation.c. References bc_cashflow, and OFFSET_FOR_CASHFLOW_BC. |
|
update the vgame entries Updates the BuildCount array after a load game. Definition at line 1137 of file simulation.c. References bc_coalplants, bc_count_commercial, bc_count_industrial, bc_count_residential, bc_count_roads, bc_count_trees, bc_fire, bc_fire_stations, bc_military_bases, bc_nuclearplants, bc_police_departments, bc_powerlines, bc_value_commercial, bc_value_industrial, bc_value_residential, bc_value_roads, bc_waste, bc_water, bc_waterpipes, bc_waterpumps, getWorld(), IsCommercial, IsFakeTree, IsFakeWater, IsIndustrial, IsPowerLine(), IsPowerWater(), IsPump, IsResidential, IsRoad(), IsRoadPipe(), IsRoadPower(), IsWaterPipe(), LockZone(), lz_flags, lz_world, MapMul, UInt32, UInt8, UnlockZone(), and ZoneValue(). Referenced by PostLoadGame(). |
|
get the value of the zone
Definition at line 1371 of file simulation.c. References IsRail(), IsRoad(), and welem_t. Referenced by Build_Destroy(), querySetup(), and UpdateVolatiles(). |