#include <config.h>
#include <sys/types.h>
#include <stddef.h>
#include <assert.h>
#include <zakdef.h>
#include <compilerpragmas.h>
#include <build.h>
#include <globals.h>
#include <ui.h>
#include <logging.h>
#include <locking.h>
#include <drawing.h>
#include <simulation.h>
#include <sections.h>
Go to the source code of this file.
Data Structures | |
struct | _bldStruct |
array mapping build requests to reactions. More... | |
struct | _costMappings |
Mapping of zone to cost of building on a zone. More... | |
struct | buildCounters |
Maps build units to locations in the build array. More... | |
Typedefs | |
typedef int(* | BuildF )(UInt16 xpos, UInt16 ypos, welem_t type) |
Defines the build function pointer type. | |
Functions | |
int | Build_Road (UInt16 xpos, UInt16 ypos, welem_t type) BUILD_SECTION |
Build a road. | |
int | Build_Rail (UInt16 xpos, UInt16 ypos, welem_t type) BUILD_SECTION |
Build a rail line. | |
int | Build_PowerLine (UInt16 xpos, UInt16 ypos, welem_t type) BUILD_SECTION |
Build a power line. | |
int | Build_WaterPipe (UInt16 xpos, UInt16 ypos, welem_t type) BUILD_SECTION |
Build a water pipe. | |
int | Build_Generic (UInt16 xpos, UInt16 ypos, welem_t type) BUILD_SECTION |
Build a generic item. | |
int | Build_Generic4 (UInt16 xpos, UInt16 ypos, welem_t type) BUILD_SECTION |
Build a generic 4-zone item. | |
int | Build_Defence (UInt16 xpos, UInt16 ypos, welem_t type) BUILD_SECTION |
Build a defence unit. | |
void | CreateForest (UInt32 pos, UInt16 size) BUILD_SECTION |
create a single forest at the point specified | |
void | RemoveDefence (UInt16 xpos, UInt16 ypos) BUILD_SECTION |
Remove a defence unit from a location. | |
int | CantBulldoze (welem_t type) BUILD_SECTION |
check that I can't bulldoze a zone | |
UInt16 | blockSize (welem_t type) BUILD_SECTION |
get the blocksize of the item in question (1x1, 2x2) | |
void | Doff (welem_t base, welem_t node, UInt16 *x, UInt16 *y) BUILD_SECTION |
Determine the offsetting for destroying a node - 2x2 *only*. | |
Int16 | IsBulldozable (welem_t zone) BUILD_SECTION |
check if a zone is bulldozable | |
Int16 | SpendMoney (UInt32 howMuch) |
Spend a chunk of cash. | |
int | BuildSomething (UInt16 xpos, UInt16 ypos) |
Build something at the location specified. | |
void | RemoveAllDefence (void) |
Remove all the defences on the map. | |
int | Build_Bulldoze (UInt16 xpos, UInt16 ypos, welem_t _type) |
Bulldoze a zone. | |
void | Build_Destroy (UInt16 xpos, UInt16 ypos) |
Attempt to destroy the item at the position in question. | |
void | CreateFullRiver (void) |
Create a river on the map. | |
void | CreateForests (void) |
Create the forests on the map. | |
Variables | |
const struct _bldStruct | buildStructure [] |
array mapping build requests to reactions. | |
const struct buildCounters | counters [] |
Maps build units to locations in the build array. | |
const struct _costMappings | genericMappings [] |
Mapping of zone to cost of building on a zone. |
It is controlled by the table buildStructure, which defines all the items that can be built.
Definition in file build.c.
|
get the blocksize of the item in question (1x1, 2x2)
Definition at line 282 of file build.c. References welem_t. Referenced by Build_Bulldoze(). |
|
Bulldoze a zone.
Definition at line 291 of file build.c. References blockSize(), BUILD_COST_BULLDOZER, Build_Destroy(), CantBulldoze(), getWorld(), LockZone(), lz_world, peOutOfMoney, RemoveDefence(), SpendMoney(), UInt16, UIProblemNotify(), UnlockZone(), welem_t, and WORLDPOS. Referenced by button_press_event(), and motion_notify_event(). |
|
Build a defence unit.
Definition at line 174 of file build.c. References buildCounters::counter, counters, DrawCross(), buildCounters::end, Int16, LockZone(), lz_world, NUM_OF_UNITS, buildCounters::start, UInt16, UnlockZone(), and welem_t. |
|
|
Build a generic item. type to build is based on the type passed in
Definition at line 598 of file build.c. References bc_count_roads, BUILD_COST_BULLDOZER, _costMappings::cost, _costMappings::count, DrawCross(), getWorld(), IsBulldozable(), IsRoad(), LockZone(), lz_flags, lz_world, peOutOfMoney, setWorldAndFlag(), SpendMoney(), UInt16, UInt32, UIProblemNotify(), UnlockZone(), welem_t, and WORLDPOS. |
|
Build a generic 4-zone item. type to build is based on the type passed in
Definition at line 530 of file build.c. References BUILD_COST_BULLDOZER, _costMappings::cost, _costMappings::count, DrawCross(), getWorld(), Int8, IsBulldozable(), LockZone(), lz_flags, lz_world, peOutOfMoney, setWorldAndFlag(), SpendMoney(), UInt16, UIProblemNotify(), UnlockZone(), welem_t, and WORLDPOS. |
|
Build a power line. Auto bulldoze if requested.
Definition at line 888 of file build.c. References bc_powerlines, BUILD_COST_BULLDOZER, BUILD_COST_POWER_LINE, DrawCross(), getWorld(), IsBulldozable(), IsRail(), IsRoad(), IsWaterPipe(), LockZone(), lz_flags, lz_world, peOutOfMoney, setWorldAndFlag(), SpendMoney(), UInt16, UInt32, UIProblemNotify(), UnlockZone(), welem_t, and WORLDPOS. |
|
Build a rail line. Auto bulldoze if requested
Definition at line 773 of file build.c. References bc_count_rail, BUILD_COST_BULLDOZER, BUILD_COST_RAIL, BUILD_COST_RAILTUNNEL, CheckNextTo(), DrawCross(), getWorld(), IsBulldozable(), IsPowerLine(), IsRealWater, IsRoad(), IsWaterPipe(), LockZone(), lz_flags, lz_world, peOutOfMoney, setWorldAndFlag(), SpendMoney(), UInt16, UInt32, UInt8, UIProblemNotify(), UnlockZone(), welem_t, and WORLDPOS. |
|
Build a road. Auto bulldoze if requested
Definition at line 660 of file build.c. References bc_count_roads, BUILD_COST_BRIDGE, BUILD_COST_BULLDOZER, BUILD_COST_ROAD, CheckNextTo(), DrawCross(), getWorld(), IsBulldozable(), IsPowerLine(), IsRail(), IsRealWater, IsWaterPipe(), LockZone(), lz_flags, lz_world, peOutOfMoney, setWorldAndFlag(), SpendMoney(), UInt16, UInt32, UInt8, UIProblemNotify(), UnlockZone(), welem_t, and WORLDPOS. |
|
Build a water pipe. Auto bulldoze as needed
Definition at line 959 of file build.c. References bc_waterpipes, BUILD_COST_BULLDOZER, BUILD_COST_WATER_PIPE, DrawCross(), getWorld(), IsBulldozable(), IsPowerLine(), IsRail(), IsRoad(), LockZone(), lz_flags, lz_world, peOutOfMoney, setWorldAndFlag(), SpendMoney(), UInt16, UInt32, UIProblemNotify(), UnlockZone(), welem_t, and WORLDPOS. |
|
Build something at the location specified. Looks up the item in the buildStructure and builds it at the appropriate location. Definition at line 93 of file build.c. References AddGridUpdate, _bldStruct::bt, _bldStruct::func, GetGraphicNumber(), _bldStruct::gridsToUpdate, LockZone(), lz_world, _bldStruct::type, UIDisplayError1(), UIGetSelectedBuildItem(), UInt16, UIPaintMapField(), UIPaintMapStatus(), UnlockZone(), welem_t, and WORLDPOS. Referenced by button_press_event(), and motion_notify_event(). |
|
create a single forest at the point specified
Definition at line 1128 of file build.c. References bc_count_trees, getMapHeight, getMapWidth, GetRandomNumber(), getWorld(), LockZone(), lz_flags, lz_world, setWorldAndFlag(), UInt16, UInt32, UnlockZone(), and WORLDPOS. Referenced by CreateForests(). |
|
Create the forests on the map. Creates some "spraypainted" (someone called them that) forests throughout the `wilderness` Definition at line 1109 of file build.c. References CreateForest(), GetRandomNumber(), MapMul, UInt16, and UInt32. Referenced by ConfigureNewGame(). |
|
Create a river on the map.
Definition at line 1047 of file build.c. References getMapHeight, getMapWidth, GetRandomNumber(), LockZone(), lz_flags, lz_world, setWorldAndFlag(), UInt16, UnlockZone(), and WORLDPOS. Referenced by ConfigureNewGame(). |
|
Determine the offsetting for destroying a node - 2x2 *only*.
Definition at line 323 of file build.c. References UInt16, and welem_t. Referenced by Build_Destroy(). |
|
check if a zone is bulldozable
Definition at line 515 of file build.c. References GETAUTOBULLDOZE, and welem_t. Referenced by Build_Generic(), Build_Generic4(), Build_PowerLine(), Build_Rail(), Build_Road(), and Build_WaterPipe(). |
|
Remove a defence unit from a location. Removes the defence item from the location specified.
Definition at line 127 of file build.c. References DrawCross(), NUM_OF_UNITS, and UInt16. Referenced by Build_Bulldoze(), and Build_Destroy(). |
|
Spend a chunk of cash. Won't allow you to go negative.
Definition at line 1030 of file build.c. References addGraphicUpdate(), gu_credits, Int32, and UInt32. Referenced by Build_Bulldoze(), Build_Generic(), Build_Generic4(), Build_PowerLine(), Build_Rail(), Build_Road(), and Build_WaterPipe(). |
|
array mapping build requests to reactions. This structure is used to map the BuildCode to an appropriate function to perform the building as well as some extra events to happen as a consequence of the item being built. |