9 package micropolisj.engine;
39 public static final short CLEAR = -1;
40 public static final char DIRT = 0;
41 static final char RIVER = 2;
42 static final char REDGE = 3;
43 static final char CHANNEL = 4;
44 static final char RIVEDGE = 5;
45 static final char FIRSTRIVEDGE = 5;
46 static final char LASTRIVEDGE = 20;
47 static final char TREEBASE = 21;
48 static final char WOODS_LOW = TREEBASE;
49 static final char WOODS = 37;
50 static final char WOODS_HIGH = 39;
51 static final char WOODS2 = 40;
52 static final char WOODS5 = 43;
53 static final char RUBBLE = 44;
54 static final char LASTRUBBLE = 47;
55 static final char FLOOD = 48;
56 static final char LASTFLOOD = 51;
57 static final char RADTILE = 52;
58 static final char FIRE = 56;
59 static final char ROADBASE = 64;
60 static final char HBRIDGE = 64;
61 static final char VBRIDGE = 65;
62 static final char ROADS = 66;
63 static final char ROADS2 = 67;
65 private static final char ROADS3 = 68;
66 private static final char ROADS4 = 69;
67 private static final char ROADS5 = 70;
68 private static final char ROADS6 = 71;
69 private static final char ROADS7 = 72;
70 private static final char ROADS8 = 73;
71 private static final char ROADS9 = 74;
73 static final char INTERSECTION = 76;
74 static final char HROADPOWER = 77;
75 static final char VROADPOWER = 78;
76 static final char BRWH = 79;
77 static final char LTRFBASE = 80;
78 static final char BRWV = 95;
79 static final char HTRFBASE = 144;
81 static final char POWERBASE = 208;
82 static final char HPOWER = 208;
83 static final char VPOWER = 209;
84 static final char LHPOWER = 210;
85 static final char LVPOWER = 211;
86 static final char LVPOWER2 = 212;
96 static final char RAILHPOWERV = 221;
97 static final char RAILVPOWERH = 222;
98 static final char LASTPOWER = 222;
99 static final char RAILBASE = 224;
100 static final char HRAIL = 224;
101 static final char VRAIL = 225;
102 static final char LHRAIL = 226;
103 static final char LVRAIL = 227;
104 static final char LVRAIL2 = 228;
114 static final char HRAILROAD = 237;
115 static final char VRAILROAD = 238;
116 static final char LASTRAIL = 238;
117 static final char RESBASE = 240;
118 static final char RESCLR = 244;
119 static final char HOUSE = 249;
120 static final char LHTHR = 249;
121 static final char HHTHR = 260;
122 static final char RZB = 265;
123 static final char HOSPITAL = 409;
124 static final char CHURCH = 418;
125 static final char COMBASE = 423;
126 static final char COMCLR = 427;
127 static final char CZB = 436;
128 static final char INDBASE = 612;
129 static final char INDCLR = 616;
130 static final char IZB = 625;
131 static final char PORTBASE = 693;
132 static final char PORT = 698;
133 static final char AIRPORT = 716;
134 static final char POWERPLANT = 750;
135 static final char FIRESTATION = 765;
136 static final char POLICESTATION = 774;
137 static final char STADIUM = 784;
138 static final char FULLSTADIUM = 800;
139 static final char NUCLEAR = 816;
140 static final char LASTZONE = 826;
142 static final char HBRDG0 = 828;
143 static final char HBRDG1 = 829;
144 static final char HBRDG2 = 830;
145 static final char HBRDG3 = 831;
146 static final char FOUNTAIN = 840;
147 static final char TINYEXP = 860;
149 static final char FOOTBALLGAME1 = 932;
150 static final char FOOTBALLGAME2 = 940;
151 static final char VBRDG0 = 948;
152 static final char VBRDG1 = 949;
153 static final char VBRDG2 = 950;
154 static final char VBRDG3 = 951;
157 static final char UNIVERSITY = 964;
158 static final char TEMPEL = 976;
162 static final char[] RoadTable =
new char[] {
163 ROADS, ROADS2, ROADS,
ROADS3, ROADS2, ROADS2,
ROADS4,
ROADS8, ROADS,
ROADS6, ROADS,
ROADS7,
ROADS5,
ROADS10,
ROADS9,
167 static final char[] RailTable =
new char[] {
168 LHRAIL, LVRAIL, LHRAIL, LVRAIL2, LVRAIL, LVRAIL,
LVRAIL3,
LVRAIL7, LHRAIL,
LVRAIL5, LHRAIL,
LVRAIL6,
LVRAIL4,
172 static final char[] WireTable =
new char[] {
173 LHPOWER, LVPOWER, LHPOWER, LVPOWER2, LVPOWER, LVPOWER,
LVPOWER3,
LVPOWER7, LHPOWER,
LVPOWER5, LHPOWER,
LVPOWER6,
199 return ((tileValue >= FIRSTRIVEDGE && tileValue <= LASTRUBBLE) || (tileValue >= TINYEXP && tileValue <=
LASTTINYEXP));
212 if((tileValue >= FIRSTRIVEDGE && tileValue <= LASTRUBBLE) || (tileValue >= POWERBASE + 2 && tileValue <= POWERBASE + 12)
213 || (tileValue >= TINYEXP && tileValue <=
LASTTINYEXP)) {
223 assert (tile &
LOMASK) == tile;
231 assert (tile &
LOMASK) == tile;
243 assert (tile &
LOMASK) == tile;
250 assert (tile &
LOMASK) == tile;
253 return spec != null && spec.animNext != null;
258 assert (tile &
LOMASK) == tile;
260 return (!
isZoneCenter(tile) && tile >= LHTHR && tile <= LASTZONE);
269 assert (tile &
LOMASK) == tile;
272 return spec != null && spec.canBurn;
276 assert (tile &
LOMASK) == tile;
279 return spec != null && spec.canConduct;
284 assert (tile &
LOMASK) == tile;
286 return tile >= RUBBLE && tile < ROADBASE;
291 assert (tile &
LOMASK) == tile;
293 return tile >= FLOOD && tile < ROADBASE;
297 assert (tile &
LOMASK) == tile;
300 return spec != null && spec.overWater;
304 assert (tile &
LOMASK) == tile;
306 return ((tile >= RUBBLE) && (tile <= LASTRUBBLE));
309 public static boolean isTree(
char tile) {
310 assert (tile &
LOMASK) == tile;
312 return ((tile >= WOODS_LOW) && (tile <= WOODS_HIGH));
317 assert (tile &
LOMASK) == tile;
319 if(tile < RESBASE || tile > LASTZONE ||
isZoneCenter(tile)) {
328 assert (tile &
LOMASK) == tile;
330 return (tile == POWERBASE || tile == POWERBASE + 1 || tile == RAILBASE || tile == RAILBASE + 1 || tile == BRWH || tile == BRWV);
335 assert (tile &
LOMASK) == tile;
342 assert (tile &
LOMASK) == tile;
344 return tile >= 0 && tile >= ROADBASE;
347 static boolean isRiverEdge(
int tile) {
348 assert (tile &
LOMASK) == tile;
350 return tile >= FIRSTRIVEDGE && tile <= LASTRIVEDGE;
354 assert (tile &
LOMASK) == tile;
357 return spec != null && spec.canBulldoze;
360 static boolean isFloodable(
int tile) {
361 assert (tile &
LOMASK) == tile;
372 assert (tile &
LOMASK) == tile;
374 return (tile >= ROADBASE && tile < POWERBASE);
378 assert (tile &
LOMASK) == tile;
380 return (tile >= ROADBASE && tile < POWERBASE) || (tile == HRAILROAD) || (tile == VRAILROAD);
389 return (tmp >= ROADS && tmp <= INTERSECTION);
394 return (((tile == VRAILROAD) || (tile >= ROADBASE && tile <= VROADPOWER)) && (tile != VROADPOWER) && (tile != HRAILROAD) && (tile != VBRIDGE));
399 return (((tile == HRAILROAD) || (tile >= ROADBASE && tile <= VROADPOWER)) && (tile != HROADPOWER) && (tile != VRAILROAD) && (tile != ROADBASE));
404 return (((tile == HRAILROAD) || (tile >= ROADBASE && tile <= VROADPOWER)) && (tile != HROADPOWER) && (tile != VRAILROAD) && (tile != ROADBASE));
409 return (((tile == VRAILROAD) || (tile >= ROADBASE && tile <= VROADPOWER)) && (tile != VROADPOWER) && (tile != HRAILROAD) && (tile != VBRIDGE));
413 assert (tile &
LOMASK) == tile;
415 return (tile >= RAILBASE && tile < RESBASE);
419 assert (tile &
LOMASK) == tile;
421 return (tile >= RAILBASE && tile < RESBASE) || (tile == RAILHPOWERV) || (tile == RAILVPOWERH);
425 assert (tile &
LOMASK) == tile;
427 return (tile >= LHRAIL && tile <=
LVRAIL10);
432 return (tile >= RAILHPOWERV && tile <= VRAILROAD && tile != RAILVPOWERH && tile != VRAILROAD && tile != VRAIL);
437 return (tile >= RAILHPOWERV && tile <= VRAILROAD && tile != RAILHPOWERV && tile != HRAILROAD && tile != HRAIL);
442 return (tile >= RAILHPOWERV && tile <= VRAILROAD && tile != RAILHPOWERV && tile != HRAILROAD && tile != HRAIL);
447 return (tile >= RAILHPOWERV && tile <= VRAILROAD && tile != RAILVPOWERH && tile != VRAILROAD && tile != VRAIL);
451 assert (tile &
LOMASK) == tile;
453 return (tile >= LHPOWER && tile <=
LVPOWER10);
458 return (
isConductive(tile) && ntile != HPOWER && ntile != HROADPOWER && ntile != RAILHPOWERV);
463 return (
isConductive(tile) && ntile != VPOWER && ntile != VROADPOWER && ntile != RAILVPOWERH);
468 return (
isConductive(tile) && ntile != VPOWER && ntile != VROADPOWER && ntile != RAILVPOWERH);
473 return (
isConductive(tile) && ntile != HPOWER && ntile != HROADPOWER && ntile != RAILHPOWERV);
477 assert (tile &
LOMASK) == tile;
481 if(ts.
owner != null) {
490 assert (tile &
LOMASK) == tile;
492 return tile >= HOSPITAL && tile < COMBASE;
501 assert (tile &
LOMASK) == tile;
505 if(ts.
owner != null) {
514 assert (tile &
LOMASK) == tile;
516 return tile >= RESBASE && tile <= RESBASE + 8;
525 assert (tile &
LOMASK) == tile;
527 return tile >= RESBASE && tile < HOSPITAL;
532 assert (tile &
LOMASK) == tile;
536 if(ts.
owner != null) {
546 assert (tile &
LOMASK) == tile;
548 return tile >= RESBASE;
552 assert (tile &
LOMASK) == tile;
555 return spec != null && spec.zone;
563 assert (tile &
LOMASK) == tile;
565 if(tile >= ROADBASE && tile <=
LASTROAD) {
566 tile = ((tile - ROADBASE) & 0xf) + ROADBASE;
578 assert (tile &
LOMASK) == tile;
591 assert (tile &
LOMASK) == tile;
604 assert (tile &
LOMASK) == tile;