|
@@ -406,20 +406,17 @@ void OnTick_Town(void)
|
|
|
/* Make sure each town's tickhandler invocation frequency is about the
|
|
|
* same - TOWN_GROWTH_FREQUENCY - independent on the number of towns. */
|
|
|
for (_cur_town_iter += GetTownPoolSize();
|
|
|
_cur_town_iter >= TOWN_GROWTH_FREQUENCY;
|
|
|
_cur_town_iter -= TOWN_GROWTH_FREQUENCY) {
|
|
|
uint32 i = _cur_town_ctr;
|
|
|
Town *t;
|
|
|
|
|
|
if (++_cur_town_ctr >= GetTownPoolSize())
|
|
|
_cur_town_ctr = 0;
|
|
|
|
|
|
t = GetTown(i);
|
|
|
|
|
|
if (IsValidTown(t)) TownTickHandler(t);
|
|
|
if (IsValidTownID(i)) TownTickHandler(GetTown(i));
|
|
|
}
|
|
|
}
|
|
|
|
|
|
static RoadBits GetTownRoadMask(TileIndex tile)
|
|
|
{
|
|
|
TrackBits b = GetAnyRoadTrackBits(tile);
|
|
@@ -1345,13 +1342,13 @@ static void ClearTownHouse(Town *t, Tile
|
|
|
*/
|
|
|
int32 CmdRenameTown(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
{
|
|
|
StringID str;
|
|
|
Town *t;
|
|
|
|
|
|
if (!IsTownIndex(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
|
|
|
if (!IsValidTownID(p1) || _cmd_text[0] == '\0') return CMD_ERROR;
|
|
|
|
|
|
t = GetTown(p1);
|
|
|
|
|
|
str = AllocateNameUnique(_cmd_text, 4);
|
|
|
if (str == 0) return CMD_ERROR;
|
|
|
|
|
@@ -1602,13 +1599,13 @@ extern uint GetMaskOfTownActions(int *nu
|
|
|
*/
|
|
|
int32 CmdDoTownAction(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|
|
{
|
|
|
int32 cost;
|
|
|
Town *t;
|
|
|
|
|
|
if (!IsTownIndex(p1) || p2 > lengthof(_town_action_proc)) return CMD_ERROR;
|
|
|
if (!IsValidTownID(p1) || p2 > lengthof(_town_action_proc)) return CMD_ERROR;
|
|
|
|
|
|
t = GetTown(p1);
|
|
|
|
|
|
if (!HASBIT(GetMaskOfTownActions(NULL, _current_player, t), p2)) return CMD_ERROR;
|
|
|
|
|
|
SET_EXPENSES_TYPE(EXPENSES_OTHER);
|