Micropolis
connect.cpp
Go to the documentation of this file.
1 /* connect.cpp
2  *
3  * Micropolis, Unix Version. This game was released for the Unix platform
4  * in or about 1990 and has been modified for inclusion in the One Laptop
5  * Per Child program. Copyright (C) 1989 - 2007 Electronic Arts Inc. If
6  * you need assistance with this program, you may contact:
7  * http://wiki.laptop.org/go/Micropolis or email micropolis@laptop.org.
8  *
9  * This program is free software: you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation, either version 3 of the License, or (at
12  * your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful, but
15  * WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  * General Public License for more details. You should have received a
18  * copy of the GNU General Public License along with this program. If
19  * not, see <http://www.gnu.org/licenses/>.
20  *
21  * ADDITIONAL TERMS per GNU GPL Section 7
22  *
23  * No trademark or publicity rights are granted. This license does NOT
24  * give you any right, title or interest in the trademark SimCity or any
25  * other Electronic Arts trademark. You may not distribute any
26  * modification of this program using the trademark SimCity or claim any
27  * affliation or association with Electronic Arts Inc. or its employees.
28  *
29  * Any propagation or conveyance of this program must include this
30  * copyright notice and these terms.
31  *
32  * If you convey this program (or any modifications of it) and assume
33  * contractual liability for the program to recipients of it, you agree
34  * to indemnify Electronic Arts for any liability that those contractual
35  * assumptions impose on Electronic Arts.
36  *
37  * You may not misrepresent the origins of this program; modified
38  * versions of the program must be marked as such and not identified as
39  * the original program.
40  *
41  * This disclaimer supplements the one included in the General Public
42  * License. TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, THIS
43  * PROGRAM IS PROVIDED TO YOU "AS IS," WITH ALL FAULTS, WITHOUT WARRANTY
44  * OF ANY KIND, AND YOUR USE IS AT YOUR SOLE RISK. THE ENTIRE RISK OF
45  * SATISFACTORY QUALITY AND PERFORMANCE RESIDES WITH YOU. ELECTRONIC ARTS
46  * DISCLAIMS ANY AND ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES,
47  * INCLUDING IMPLIED WARRANTIES OF MERCHANTABILITY, SATISFACTORY QUALITY,
48  * FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT OF THIRD PARTY
49  * RIGHTS, AND WARRANTIES (IF ANY) ARISING FROM A COURSE OF DEALING,
50  * USAGE, OR TRADE PRACTICE. ELECTRONIC ARTS DOES NOT WARRANT AGAINST
51  * INTERFERENCE WITH YOUR ENJOYMENT OF THE PROGRAM; THAT THE PROGRAM WILL
52  * MEET YOUR REQUIREMENTS; THAT OPERATION OF THE PROGRAM WILL BE
53  * UNINTERRUPTED OR ERROR-FREE, OR THAT THE PROGRAM WILL BE COMPATIBLE
54  * WITH THIRD PARTY SOFTWARE OR THAT ANY ERRORS IN THE PROGRAM WILL BE
55  * CORRECTED. NO ORAL OR WRITTEN ADVICE PROVIDED BY ELECTRONIC ARTS OR
56  * ANY AUTHORIZED REPRESENTATIVE SHALL CREATE A WARRANTY. SOME
57  * JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF OR LIMITATIONS ON IMPLIED
58  * WARRANTIES OR THE LIMITATIONS ON THE APPLICABLE STATUTORY RIGHTS OF A
59  * CONSUMER, SO SOME OR ALL OF THE ABOVE EXCLUSIONS AND LIMITATIONS MAY
60  * NOT APPLY TO YOU.
61  */
62 
79 
80 
81 #include "micropolis.h"
82 
83 
85 
86 
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
92 };
93 
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
99 };
100 
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
106 };
107 
108 
110 
116 static inline MapTile neutralizeRoad(MapTile tile)
117 {
118  if (tile >= 64 && tile <= 207) {
119  tile = (tile & 0x000F) + 64;
120  }
121  return tile;
122 };
123 
134  ConnectTileCommand cmd, ToolEffects *effects)
135 {
136  ToolResult result = TOOLRESULT_OK;
137 
138  // Make sure the array subscripts are in bounds.
139  if (!testBounds(x, y)) {
140  return TOOLRESULT_FAILED;
141  }
142 
143  // Perform auto-doze if appropriate.
144  switch (cmd) {
145 
146  case CONNECT_TILE_ROAD:
148  case CONNECT_TILE_WIRE:
149 
150  // Silently skip auto-bulldoze if no money.
151  if (autoBulldoze) {
152 
153  MapValue mapVal = effects->getMapValue(x, y);
154 
155  if (mapVal & BULLBIT) {
156  mapVal &= LOMASK;
157  mapVal = neutralizeRoad(mapVal);
158 
159  /* Maybe this should check BULLBIT instead of checking tile values? */
160  if ((mapVal >= TINYEXP && mapVal <= LASTTINYEXP) ||
161  (mapVal < HBRIDGE && mapVal != DIRT)) {
162 
163  effects->addCost(1);
164 
165  effects->setMapValue(x, y, DIRT);
166 
167  }
168  }
169  }
170  break;
171 
172  default:
173  // Do nothing.
174  break;
175 
176  }
177 
178  // Perform the command.
179  switch (cmd) {
180 
181  case CONNECT_TILE_FIX: // Fix zone.
182  fixZone(x, y, effects);
183  break;
184 
185  case CONNECT_TILE_BULLDOZE: // Bulldoze zone.
186  result = layDoze(x, y, effects);
187  fixZone(x, y, effects);
188  break;
189 
190  case CONNECT_TILE_ROAD: // Lay road.
191  result = layRoad(x, y, effects);
192  fixZone(x, y, effects);
193  break;
194 
195  case CONNECT_TILE_RAILROAD: // Lay railroad.
196  result = layRail(x, y, effects);
197  fixZone(x, y, effects);
198  break;
199 
200  case CONNECT_TILE_WIRE: // Lay wire.
201  result = layWire(x, y, effects);
202  fixZone(x, y, effects);
203  break;
204 
205  default:
206  NOT_REACHED();
207  break;
208 
209  }
210 
211  return result;
212 }
213 
214 
223 {
224  MapValue tile = effects->getMapValue(x, y);
225 
226  if (!(tile & BULLBIT)) {
227  return TOOLRESULT_FAILED; /* Check dozeable bit. */
228  }
229 
230  tile &= LOMASK;
231  tile = neutralizeRoad(tile);
232 
233  switch (tile) {
234  case HBRIDGE:
235  case VBRIDGE:
236  case BRWV:
237  case BRWH:
238  case HBRDG0:
239  case HBRDG1:
240  case HBRDG2:
241  case HBRDG3:
242  case VBRDG0:
243  case VBRDG1:
244  case VBRDG2:
245  case VBRDG3:
246  case HPOWER:
247  case VPOWER:
248  case HRAIL:
249  case VRAIL: /* Dozing over water, replace with water. */
250  effects->setMapValue(x, y, RIVER);
251  break;
252 
253  default: /* Dozing on land, replace with land. Simple, eh? */
254  effects->setMapValue(x, y, DIRT);
255  break;
256  }
257 
258  effects->addCost(1); /* Costs $1.00.... */
259 
260  return TOOLRESULT_OK;
261 }
262 
263 
272 {
273  int cost = 10;
274 
275  MapTile tile = effects->getMapTile(x, y);
276 
277  switch (tile) {
278 
279  case DIRT:
280  effects->setMapValue(x, y, ROADS | BULLBIT | BURNBIT);
281  break;
282 
283  case RIVER: /* Road on Water */
284  case REDGE:
285  case CHANNEL: /* Check how to build bridges, if possible. */
286  cost = 50;
287 
288  if (x < WORLD_W - 1) {
289  tile = effects->getMapTile(x + 1, y);
290  tile = neutralizeRoad(tile);
291  if (tile == VRAILROAD || tile == HBRIDGE
292  || (tile >= ROADS && tile <= HROADPOWER)) {
293  effects->setMapValue(x, y, HBRIDGE | BULLBIT);
294  break;
295  }
296  }
297 
298  if (x > 0) {
299  tile = effects->getMapTile(x - 1, y);
300  tile = neutralizeRoad(tile);
301  if (tile == VRAILROAD || tile == HBRIDGE
302  || (tile >= ROADS && tile <= INTERSECTION)) {
303  effects->setMapValue(x, y, HBRIDGE | BULLBIT);
304  break;
305  }
306  }
307 
308  if (y < WORLD_H - 1) {
309  tile = effects->getMapTile(x, y + 1);
310  tile = neutralizeRoad(tile);
311  if (tile == HRAILROAD || tile == VROADPOWER
312  || (tile >= VBRIDGE && tile <= INTERSECTION)) {
313  effects->setMapValue(x, y, VBRIDGE | BULLBIT);
314  break;
315  }
316  }
317 
318  if (y > 0) {
319  tile = effects->getMapTile(x, y - 1);
320  tile = neutralizeRoad(tile);
321  if (tile == HRAILROAD || tile == VROADPOWER
322  || (tile >= VBRIDGE && tile <= INTERSECTION)) {
323  effects->setMapValue(x, y, VBRIDGE | BULLBIT);
324  break;
325  }
326  }
327 
328  /* Can't do road... */
329  return TOOLRESULT_FAILED;
330 
331  case LHPOWER: /* Road on power */
332  effects->setMapValue(x, y, VROADPOWER | CONDBIT | BURNBIT | BULLBIT);
333  break;
334 
335  case LVPOWER: /* Road on power #2 */
336  effects->setMapValue(x, y, HROADPOWER | CONDBIT | BURNBIT | BULLBIT);
337  break;
338 
339  case LHRAIL: /* Road on rail */
340  effects->setMapValue(x, y, HRAILROAD | BURNBIT | BULLBIT);
341  break;
342 
343  case LVRAIL: /* Road on rail #2 */
344  effects->setMapValue(x, y, VRAILROAD | BURNBIT | BULLBIT);
345  break;
346 
347  default: /* Can't do road */
348  return TOOLRESULT_FAILED;
349 
350  }
351 
352  effects->addCost(cost);
353  return TOOLRESULT_OK;
354 }
355 
356 
365 {
366  int cost = 20;
367 
368  MapTile tile = effects->getMapTile(x, y);
369 
370  tile = neutralizeRoad(tile);
371 
372  switch (tile) {
373  case DIRT: /* Rail on Dirt */
374 
375  effects->setMapValue(x, y, LHRAIL | BULLBIT | BURNBIT);
376 
377  break;
378 
379  case RIVER: /* Rail on Water */
380  case REDGE:
381  case CHANNEL: /* Check how to build underwater tunnel, if possible. */
382 
383  cost = 100;
384 
385  if (x < WORLD_W - 1) {
386  tile = effects->getMapTile(x + 1, y);
387  tile = neutralizeRoad(tile);
388  if (tile == RAILHPOWERV || tile == HRAIL
389  || (tile >= LHRAIL && tile <= HRAILROAD)) {
390  effects->setMapValue(x, y, HRAIL | BULLBIT);
391  break;
392  }
393  }
394 
395  if (x > 0) {
396  tile = effects->getMapTile(x - 1, y);
397  tile = neutralizeRoad(tile);
398  if (tile == RAILHPOWERV || tile == HRAIL
399  || (tile > VRAIL && tile < VRAILROAD)) {
400  effects->setMapValue(x, y, HRAIL | BULLBIT);
401  break;
402  }
403  }
404 
405  if (y < WORLD_H - 1) {
406  tile = effects->getMapTile(x, y + 1);
407  tile = neutralizeRoad(tile);
408  if (tile == RAILVPOWERH || tile == VRAILROAD
409  || (tile > HRAIL && tile < HRAILROAD)) {
410  effects->setMapValue(x, y, VRAIL | BULLBIT);
411  break;
412  }
413  }
414 
415  if (y > 0) {
416  tile = effects->getMapTile(x, y - 1);
417  tile = neutralizeRoad(tile);
418  if (tile == RAILVPOWERH || tile == VRAILROAD
419  || (tile > HRAIL && tile < HRAILROAD)) {
420  effects->setMapValue(x, y, VRAIL | BULLBIT);
421  break;
422  }
423  }
424 
425  /* Can't do rail... */
426  return TOOLRESULT_FAILED;
427 
428  case LHPOWER: /* Rail on power */
429  effects->setMapValue(x, y, RAILVPOWERH | CONDBIT | BURNBIT | BULLBIT);
430  break;
431 
432  case LVPOWER: /* Rail on power #2 */
433  effects->setMapValue(x, y, RAILHPOWERV | CONDBIT | BURNBIT | BULLBIT);
434  break;
435 
436  case ROADS: /* Rail on road */
437  effects->setMapValue(x, y, VRAILROAD | BURNBIT | BULLBIT);
438  break;
439 
440  case ROADS2: /* Rail on road #2 */
441  effects->setMapValue(x, y, HRAILROAD | BURNBIT | BULLBIT);
442  break;
443 
444  default: /* Can't do rail */
445  return TOOLRESULT_FAILED;
446  }
447 
448  effects->addCost(cost);
449  return TOOLRESULT_OK;
450 }
451 
452 
461 {
462  int cost = 5;
463 
464  MapTile tile = effects->getMapTile(x, y);
465 
466  tile = neutralizeRoad(tile);
467 
468  switch (tile) {
469 
470  case DIRT: /* Wire on Dirt */
471 
472  effects->setMapValue(x, y, LHPOWER | CONDBIT | BURNBIT | BULLBIT);
473 
474  break;
475 
476  case RIVER: /* Wire on Water */
477  case REDGE:
478  case CHANNEL: /* Check how to lay underwater wire, if possible. */
479 
480  cost = 25;
481 
482  if (x < WORLD_W - 1) {
483  tile = effects->getMapValue(x + 1, y);
484  if (tile & CONDBIT) {
485  tile &= LOMASK;
486  tile = neutralizeRoad(tile);
487  if (tile != HROADPOWER && tile != RAILHPOWERV && tile != HPOWER) {
488  effects->setMapValue(x, y, VPOWER | CONDBIT | BULLBIT);
489  break;
490  }
491  }
492  }
493 
494  if (x > 0) {
495  tile = effects->getMapValue(x - 1, y);
496  if (tile & CONDBIT) {
497  tile &= LOMASK;
498  tile = neutralizeRoad(tile);
499  if (tile != HROADPOWER && tile != RAILHPOWERV && tile != HPOWER) {
500  effects->setMapValue(x, y, VPOWER | CONDBIT | BULLBIT);
501  break;
502  }
503  }
504  }
505 
506  if (y < WORLD_H - 1) {
507  tile = effects->getMapValue(x, y + 1);
508  if (tile & CONDBIT) {
509  tile &= LOMASK;
510  tile = neutralizeRoad(tile);
511  if (tile != VROADPOWER && tile != RAILVPOWERH && tile != VPOWER) {
512  effects->setMapValue(x, y, HPOWER | CONDBIT | BULLBIT);
513  break;
514  }
515  }
516  }
517 
518  if (y > 0) {
519  tile = effects->getMapValue(x, y - 1);
520  if (tile & CONDBIT) {
521  tile &= LOMASK;
522  tile = neutralizeRoad(tile);
523  if (tile != VROADPOWER && tile != RAILVPOWERH && tile != VPOWER) {
524  effects->setMapValue(x, y, HPOWER | CONDBIT | BULLBIT);
525  break;
526  }
527  }
528  }
529 
530  /* Can't do wire... */
531  return TOOLRESULT_FAILED;
532 
533  case ROADS: /* Wire on Road */
534  effects->setMapValue(x, y, HROADPOWER | CONDBIT | BURNBIT | BULLBIT);
535  break;
536 
537  case ROADS2: /* Wire on Road #2 */
538  effects->setMapValue(x, y, VROADPOWER | CONDBIT | BURNBIT | BULLBIT);
539  break;
540 
541  case LHRAIL: /* Wire on rail */
542  effects->setMapValue(x, y, RAILHPOWERV | CONDBIT | BURNBIT | BULLBIT);
543  break;
544 
545  case LVRAIL: /* Wire on rail #2 */
546  effects->setMapValue(x, y, RAILVPOWERH | CONDBIT | BURNBIT | BULLBIT);
547  break;
548 
549  default: /* Can't do wire */
550  return TOOLRESULT_FAILED;
551 
552  }
553 
554  effects->addCost(cost);
555  return TOOLRESULT_OK;
556 }
557 
558 
565 void Micropolis::fixZone(int x, int y, ToolEffects *effects)
566 {
567  fixSingle(x, y, effects);
568 
569  if (y > 0) {
570  fixSingle(x, y - 1, effects);
571  }
572 
573  if (x < WORLD_W - 1) {
574  fixSingle(x + 1, y, effects);
575  }
576 
577  if (y < WORLD_H - 1) {
578  fixSingle(x, y + 1, effects);
579  }
580 
581  if (x > 0) {
582  fixSingle(x - 1, y, effects);
583  }
584 }
585 
586 
593 void Micropolis::fixSingle(int x, int y, ToolEffects *effects)
594 {
595  unsigned short adjTile = 0;
596 
597  MapTile tile = effects->getMapTile(x, y);
598 
599  tile = neutralizeRoad(tile);
600 
601  if (tile >= ROADS && tile <= INTERSECTION) { /* Cleanup Road */
602 
603  if (y > 0) {
604  tile = effects->getMapTile(x, y - 1);
605  tile = neutralizeRoad(tile);
606  if ((tile == HRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER))
607  && tile != HROADPOWER && tile != VRAILROAD
608  && tile != ROADBASE) {
609  adjTile |= 0x0001;
610  }
611  }
612 
613  if (x < WORLD_W - 1) {
614  tile = effects->getMapTile(x + 1, y);
615  tile = neutralizeRoad(tile);
616  if ((tile == VRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER))
617  && tile != VROADPOWER && tile != HRAILROAD
618  && tile != VBRIDGE) {
619  adjTile |= 0x0002;
620  }
621  }
622 
623  if (y < WORLD_H - 1) {
624  tile = effects->getMapTile(x, y + 1);
625  tile = neutralizeRoad(tile);
626  if ((tile == HRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER))
627  && tile != HROADPOWER && tile != VRAILROAD
628  && tile != ROADBASE) {
629  adjTile |= 0x0004;
630  }
631  }
632 
633  if (x > 0) {
634  tile = effects->getMapTile(x - 1, y);
635  tile = neutralizeRoad(tile);
636  if ((tile == VRAILROAD || (tile >= ROADBASE && tile <= VROADPOWER))
637  && tile != VROADPOWER && tile != HRAILROAD
638  && tile != VBRIDGE) {
639  adjTile |= 0x0008;
640  }
641  }
642 
643  effects->setMapValue(x, y, RoadTable[adjTile] | BULLBIT | BURNBIT);
644  return;
645  }
646 
647  if (tile >= LHRAIL && tile <= LVRAIL10) { /* Cleanup Rail */
648 
649  if (y > 0) {
650  tile = effects->getMapTile(x, y - 1);
651  tile = neutralizeRoad(tile);
652  if (tile >= RAILHPOWERV && tile <= VRAILROAD
653  && tile != RAILHPOWERV && tile != HRAILROAD
654  && tile != HRAIL) {
655  adjTile |= 0x0001;
656  }
657  }
658 
659  if (x < WORLD_W - 1) {
660  tile = effects->getMapTile(x + 1, y);
661  tile = neutralizeRoad(tile);
662  if (tile >= RAILHPOWERV && tile <= VRAILROAD
663  && tile != RAILVPOWERH && tile != VRAILROAD
664  && tile != VRAIL) {
665  adjTile |= 0x0002;
666  }
667  }
668 
669  if (y < WORLD_H - 1) {
670  tile = effects->getMapTile(x, y + 1);
671  tile = neutralizeRoad(tile);
672  if (tile >= RAILHPOWERV && tile <= VRAILROAD
673  && tile != RAILHPOWERV && tile != HRAILROAD
674  && tile != HRAIL) {
675  adjTile |= 0x0004;
676  }
677  }
678 
679  if (x > 0) {
680  tile = effects->getMapTile(x - 1, y);
681  tile = neutralizeRoad(tile);
682  if (tile >= RAILHPOWERV && tile <= VRAILROAD
683  && tile != RAILVPOWERH && tile != VRAILROAD
684  && tile != VRAIL) {
685  adjTile |= 0x0008;
686  }
687  }
688 
689  effects->setMapValue(x, y, RailTable[adjTile] | BULLBIT | BURNBIT);
690  return;
691  }
692 
693  if (tile >= LHPOWER && tile <= LVPOWER10) { /* Cleanup Wire */
694 
695  if (y > 0) {
696  tile = effects->getMapValue(x, y - 1);
697  if (tile & CONDBIT) {
698  tile &= LOMASK;
699  tile = neutralizeRoad(tile);
700  if (tile != VPOWER && tile != VROADPOWER && tile != RAILVPOWERH) {
701  adjTile |= 0x0001;
702  }
703  }
704  }
705 
706  if (x < WORLD_W - 1) {
707  tile = effects->getMapValue(x + 1, y);
708  if (tile & CONDBIT) {
709  tile &= LOMASK;
710  tile = neutralizeRoad(tile);
711  if (tile != HPOWER && tile != HROADPOWER && tile != RAILHPOWERV) {
712  adjTile |= 0x0002;
713  }
714  }
715  }
716 
717  if (y < WORLD_H - 1) {
718  tile = effects->getMapValue(x, y + 1);
719  if (tile & CONDBIT) {
720  tile &= LOMASK;
721  tile = neutralizeRoad(tile);
722  if (tile != VPOWER && tile != VROADPOWER && tile != RAILVPOWERH) {
723  adjTile |= 0x0004;
724  }
725  }
726  }
727 
728  if (x > 0) {
729  tile = effects->getMapValue(x - 1, y);
730  if (tile & CONDBIT) {
731  tile &= LOMASK;
732  tile = neutralizeRoad(tile);
733  if (tile != HPOWER && tile != HROADPOWER && tile != RAILHPOWERV) {
734  adjTile |= 0x0008;
735  }
736  }
737  }
738 
739  effects->setMapValue(x, y, WireTable[adjTile] | BLBNCNBIT);
740  return;
741  }
742 }
743 
744 
void fixZone(int x, int y, ToolEffects *effects)
Definition: connect.cpp:565
ToolResult layDoze(int x, int y, ToolEffects *effects)
Definition: connect.cpp:222
ToolResult connectTile(short x, short y, ConnectTileCommand cmd, ToolEffects *effects)
Definition: connect.cpp:133
ToolResult layWire(int x, int y, ToolEffects *effects)
Definition: connect.cpp:460
ToolResult layRail(int x, int y, ToolEffects *effects)
Definition: connect.cpp:364
static bool testBounds(int wx, int wy)
Definition: micropolis.h:2378
void fixSingle(int x, int y, ToolEffects *effects)
Definition: connect.cpp:593
ToolResult layRoad(int x, int y, ToolEffects *effects)
Definition: connect.cpp:271
bool autoBulldoze
Definition: micropolis.h:2323
void setMapValue(const Position &pos, MapValue mapVal)
Definition: tool.cpp:186
MapTile getMapTile(const Position &pos) const
Definition: tool.h:242
void addCost(int amount)
Definition: tool.h:275
MapValue getMapValue(const Position &pos) const
Definition: tool.cpp:169
static MapTile neutralizeRoad(MapTile tile)
Definition: connect.cpp:116
static const int WORLD_H
Definition: map_type.h:95
static const int WORLD_W
Definition: map_type.h:90
Header file for Micropolis game engine.
ConnectTileCommand
Definition: micropolis.h:350
@ CONNECT_TILE_FIX
Fix zone (connect wire, road, and rail).
Definition: micropolis.h:351
@ CONNECT_TILE_ROAD
Lay road and fix zone.
Definition: micropolis.h:353
@ CONNECT_TILE_WIRE
Lay wire and fix zone.
Definition: micropolis.h:355
@ CONNECT_TILE_RAILROAD
Lay rail and fix zone.
Definition: micropolis.h:354
@ CONNECT_TILE_BULLDOZE
Bulldoze and fix zone.
Definition: micropolis.h:352
@ RAILHPOWERV
Horizontal rail, vertical power.
Definition: micropolis.h:477
@ HBRIDGE
Horizontal bridge.
Definition: micropolis.h:426
@ VBRIDGE
Vertical bridge.
Definition: micropolis.h:428
@ DIRT
Clear tile.
Definition: micropolis.h:382
@ RAILVPOWERH
Vertical rail, horizontal power.
Definition: micropolis.h:478
#define NOT_REACHED()
Definition: micropolis.h:847
ToolResult
Definition: micropolis.h:363
@ TOOLRESULT_FAILED
Cannot build here.
Definition: micropolis.h:366
@ TOOLRESULT_OK
Build succeeded.
Definition: micropolis.h:367
unsigned short MapTile
Definition: tool.h:108
@ BURNBIT
bit 13, tile can be lit.
Definition: tool.h:122
@ LOMASK
Mask for the Tiles part of the tile.
Definition: tool.h:129
@ CONDBIT
bit 14. tile can conduct electricity.
Definition: tool.h:121
@ BULLBIT
bit 12, tile is bulldozable.
Definition: tool.h:123
unsigned short MapValue
Definition: tool.h:94