126 RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER? |
127 RATING_BRIBE_DOWN_TO = -50 // XXX SHOULD BE SOMETHING LOWER? |
127 }; |
128 }; |
128 |
129 |
129 bool CheckforTownRating(uint tile, uint32 flags, Town *t, byte type); |
130 bool CheckforTownRating(uint tile, uint32 flags, Town *t, byte type); |
130 |
131 |
131 VARDEF Town _towns[250]; |
|
132 VARDEF uint _towns_size; |
|
133 |
|
134 VARDEF uint16 *_town_sort; |
132 VARDEF uint16 *_town_sort; |
135 |
133 |
|
134 extern MemoryPool _town_pool; |
|
135 |
|
136 /** |
|
137 * Get the pointer to the town with index 'index' |
|
138 */ |
136 static inline Town *GetTown(uint index) |
139 static inline Town *GetTown(uint index) |
137 { |
140 { |
138 assert(index < _towns_size); |
141 return (Town*)GetItemFromPool(&_town_pool, index); |
139 return &_towns[index]; |
|
140 } |
142 } |
141 |
143 |
142 #define FOR_ALL_TOWNS(t) for(t = _towns; t != &_towns[_towns_size]; t++) |
144 /** |
|
145 * Get the current size of the TownPool |
|
146 */ |
|
147 static inline uint16 GetTownPoolSize(void) |
|
148 { |
|
149 return _town_pool.total_items; |
|
150 } |
143 |
151 |
144 VARDEF int _total_towns; // For the AI: the amount of towns active |
152 #define FOR_ALL_TOWNS_FROM(t, start) for (t = GetTown(start); t != NULL; t = (t->index + 1 < GetTownPoolSize()) ? GetTown(t->index + 1) : NULL) |
|
153 #define FOR_ALL_TOWNS(t) FOR_ALL_TOWNS_FROM(t, 0) |
|
154 |
|
155 VARDEF uint _total_towns; // For the AI: the amount of towns active |
145 |
156 |
146 VARDEF bool _town_sort_dirty; |
157 VARDEF bool _town_sort_dirty; |
147 VARDEF byte _town_sort_order; |
158 VARDEF byte _town_sort_order; |
148 |
159 |
149 VARDEF Town *_cleared_town; |
160 VARDEF Town *_cleared_town; |