author | maedhros |
Sat, 21 Apr 2007 08:51:42 +0000 | |
changeset 6522 | 0d36695f5e85 |
parent 6520 | 978e8f5c009b |
child 7156 | 6aea806bad77 |
permissions | -rw-r--r-- |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
1 |
/* $Id$ */ |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
2 |
|
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
3 |
/** @file newgrf_town.cpp */ |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
4 |
|
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
5 |
#include "stdafx.h" |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
6 |
#include "openttd.h" |
6520
978e8f5c009b
(svn r9706) -Codechange: Support NewGRF town var 40 'largertowns' variable properly.
peter1138
parents:
6332
diff
changeset
|
7 |
#include "variables.h" |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
8 |
#include "debug.h" |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
9 |
#include "functions.h" |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
10 |
#include "town.h" |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
11 |
|
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
12 |
/** This function implements the town variables that newGRF defines. |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
13 |
* @param variable that is queried |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
14 |
* @param parameter unused |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
15 |
* @param available will return false if ever the variable asked for does not exist |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
16 |
* @param t is of course the town we are inquiring |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
17 |
* @return the value stored in the corresponding variable*/ |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
18 |
uint32 TownGetVariable(byte variable, byte parameter, bool *available, const Town *t) |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
19 |
{ |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
20 |
switch (variable) { |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
21 |
/* Larger towns */ |
6520
978e8f5c009b
(svn r9706) -Codechange: Support NewGRF town var 40 'largertowns' variable properly.
peter1138
parents:
6332
diff
changeset
|
22 |
case 0x40: |
978e8f5c009b
(svn r9706) -Codechange: Support NewGRF town var 40 'largertowns' variable properly.
peter1138
parents:
6332
diff
changeset
|
23 |
if (_patches.larger_towns == 0) return 2; |
6522
0d36695f5e85
(svn r9709) -Fix (r9706): Larger towns use t->larger_towns, not the town index.
maedhros
parents:
6520
diff
changeset
|
24 |
if (t->larger_town) return 1; |
6520
978e8f5c009b
(svn r9706) -Codechange: Support NewGRF town var 40 'largertowns' variable properly.
peter1138
parents:
6332
diff
changeset
|
25 |
return 0; |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
26 |
|
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
27 |
/* Town index */ |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
28 |
case 0x41: return t->index; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
29 |
|
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
30 |
/* Town properties */ |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
31 |
case 0x80: return t->xy; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
32 |
case 0x81: return GB(t->xy, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
33 |
case 0x82: return t->population; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
34 |
case 0x83: return GB(t->population, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
35 |
case 0x8A: return t->grow_counter; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
36 |
case 0x92: return t->flags12; // In original game, 0x92 and 0x93 are really one word. Since flags12 is a byte, this is to adjust |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
37 |
case 0x93: return 0; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
38 |
case 0x94: return t->radius[0]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
39 |
case 0x95: return GB(t->radius[0], 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
40 |
case 0x96: return t->radius[1]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
41 |
case 0x97: return GB(t->radius[1], 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
42 |
case 0x98: return t->radius[2]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
43 |
case 0x99: return GB(t->radius[2], 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
44 |
case 0x9A: return t->radius[3]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
45 |
case 0x9B: return GB(t->radius[3], 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
46 |
case 0x9C: return t->radius[4]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
47 |
case 0x9D: return GB(t->radius[4], 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
48 |
case 0x9E: return t->ratings[0]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
49 |
case 0x9F: return t->ratings[1]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
50 |
case 0xA0: return t->ratings[2]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
51 |
case 0xA1: return t->ratings[3]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
52 |
case 0xA2: return t->ratings[4]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
53 |
case 0xA3: return t->ratings[5]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
54 |
case 0xA4: return t->ratings[6]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
55 |
case 0xA5: return t->ratings[7]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
56 |
case 0xA6: return t->ratings[8]; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
57 |
case 0xAE: return t->have_ratings; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
58 |
case 0xB2: return t->statues; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
59 |
case 0xB6: return t->num_houses; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
60 |
case 0xB9: return t->growth_rate; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
61 |
case 0xBA: return t->new_max_pass; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
62 |
case 0xBB: return GB(t->new_max_pass, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
63 |
case 0xBC: return t->new_max_mail; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
64 |
case 0xBD: return GB(t->new_max_mail, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
65 |
case 0xBE: return t->new_act_pass; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
66 |
case 0xBF: return GB(t->new_act_pass, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
67 |
case 0xC0: return t->new_act_mail; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
68 |
case 0xC1: return GB(t->new_act_mail, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
69 |
case 0xC2: return t->max_pass; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
70 |
case 0xC3: return GB(t->max_pass, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
71 |
case 0xC4: return t->max_mail; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
72 |
case 0xC5: return GB(t->max_mail, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
73 |
case 0xC6: return t->act_pass; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
74 |
case 0xC7: return GB(t->act_pass, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
75 |
case 0xC8: return t->act_mail; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
76 |
case 0xC9: return GB(t->act_mail, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
77 |
case 0xCA: return t->pct_pass_transported; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
78 |
case 0xCB: return t->pct_mail_transported; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
79 |
case 0xCC: return t->new_act_food; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
80 |
case 0xCD: return GB(t->new_act_food, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
81 |
case 0xCE: return t->new_act_water; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
82 |
case 0xCF: return GB(t->new_act_water, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
83 |
case 0xD0: return t->act_food; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
84 |
case 0xD1: return GB(t->act_food, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
85 |
case 0xD2: return t->act_water; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
86 |
case 0xD3: return GB(t->act_water, 8, 8); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
87 |
case 0xD4: return t->road_build_months; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
88 |
case 0xD5: return t->fund_buildings_months; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
89 |
} |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
90 |
|
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
91 |
DEBUG(grf, 1, "Unhandled town property 0x%X", variable); |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
92 |
|
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
93 |
*available = false; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
94 |
return (uint32)-1; |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
diff
changeset
|
95 |
} |