87 static const unsigned short RoadTable[16] = {
88 ROADS, ROADS2, ROADS, ROADS3,
89 ROADS2, ROADS2, ROADS4, ROADS8,
90 ROADS, ROADS6, ROADS, ROADS7,
91 ROADS5, ROADS10, ROADS9, INTERSECTION
94 static const unsigned short RailTable[16] = {
95 LHRAIL, LVRAIL, LHRAIL, LVRAIL2,
96 LVRAIL, LVRAIL, LVRAIL3, LVRAIL7,
97 LHRAIL, LVRAIL5, LHRAIL, LVRAIL6,
98 LVRAIL4, LVRAIL9, LVRAIL8, LVRAIL10
101 static const unsigned short WireTable[16] = {
102 LHPOWER, LVPOWER, LHPOWER, LVPOWER2,
103 LVPOWER, LVPOWER, LVPOWER3, LVPOWER7,
104 LHPOWER, LVPOWER5, LHPOWER, LVPOWER6,
105 LVPOWER4, LVPOWER9, LVPOWER8, LVPOWER10
118 if (tile >= 64 && tile <= 207) {
119 tile = (tile & 0x000F) + 64;
160 if ((mapVal >= TINYEXP && mapVal <= LASTTINYEXP) ||
186 result =
layDoze(x, y, effects);
191 result =
layRoad(x, y, effects);
196 result =
layRail(x, y, effects);
201 result =
layWire(x, y, effects);
291 if (tile == VRAILROAD || tile ==
HBRIDGE
292 || (tile >= ROADS && tile <= HROADPOWER)) {
301 if (tile == VRAILROAD || tile ==
HBRIDGE
302 || (tile >= ROADS && tile <= INTERSECTION)) {
311 if (tile == HRAILROAD || tile == VROADPOWER
312 || (tile >=
VBRIDGE && tile <= INTERSECTION)) {
321 if (tile == HRAILROAD || tile == VROADPOWER
322 || (tile >=
VBRIDGE && tile <= INTERSECTION)) {
389 || (tile >= LHRAIL && tile <= HRAILROAD)) {
399 || (tile > VRAIL && tile < VRAILROAD)) {
409 || (tile > HRAIL && tile < HRAILROAD)) {
419 || (tile > HRAIL && tile < HRAILROAD)) {
487 if (tile != HROADPOWER && tile !=
RAILHPOWERV && tile != HPOWER) {
499 if (tile != HROADPOWER && tile !=
RAILHPOWERV && tile != HPOWER) {
511 if (tile != VROADPOWER && tile !=
RAILVPOWERH && tile != VPOWER) {
523 if (tile != VROADPOWER && tile !=
RAILVPOWERH && tile != VPOWER) {
595 unsigned short adjTile = 0;
601 if (tile >= ROADS && tile <= INTERSECTION) {
606 if ((tile == HRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER))
607 && tile != HROADPOWER && tile != VRAILROAD
608 && tile != ROADBASE) {
616 if ((tile == VRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER))
617 && tile != VROADPOWER && tile != HRAILROAD
626 if ((tile == HRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER))
627 && tile != HROADPOWER && tile != VRAILROAD
628 && tile != ROADBASE) {
636 if ((tile == VRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER))
637 && tile != VROADPOWER && tile != HRAILROAD
647 if (tile >= LHRAIL && tile <= LVRAIL10) {
693 if (tile >= LHPOWER && tile <= LVPOWER10) {
700 if (tile != VPOWER && tile != VROADPOWER && tile !=
RAILVPOWERH) {
711 if (tile != HPOWER && tile != HROADPOWER && tile !=
RAILHPOWERV) {
722 if (tile != VPOWER && tile != VROADPOWER && tile !=
RAILVPOWERH) {
733 if (tile != HPOWER && tile != HROADPOWER && tile !=
RAILHPOWERV) {
739 effects->
setMapValue(x, y, WireTable[adjTile] | BLBNCNBIT);
void fixZone(int x, int y, ToolEffects *effects)
ToolResult layDoze(int x, int y, ToolEffects *effects)
ToolResult connectTile(short x, short y, ConnectTileCommand cmd, ToolEffects *effects)
ToolResult layWire(int x, int y, ToolEffects *effects)
ToolResult layRail(int x, int y, ToolEffects *effects)
static bool testBounds(int wx, int wy)
void fixSingle(int x, int y, ToolEffects *effects)
ToolResult layRoad(int x, int y, ToolEffects *effects)
static MapTile neutralizeRoad(MapTile tile)
Header file for Micropolis game engine.
@ CONNECT_TILE_FIX
Fix zone (connect wire, road, and rail).
@ CONNECT_TILE_ROAD
Lay road and fix zone.
@ CONNECT_TILE_WIRE
Lay wire and fix zone.
@ CONNECT_TILE_RAILROAD
Lay rail and fix zone.
@ CONNECT_TILE_BULLDOZE
Bulldoze and fix zone.
@ RAILHPOWERV
Horizontal rail, vertical power.
@ HBRIDGE
Horizontal bridge.
@ VBRIDGE
Vertical bridge.
@ RAILVPOWERH
Vertical rail, horizontal power.
@ TOOLRESULT_FAILED
Cannot build here.
@ TOOLRESULT_OK
Build succeeded.