(svn r23407) -Codechange: Keep a bitmap of all cargos accepted by towns.

This commit is contained in:
terkhen
2011-12-03 22:23:10 +00:00
parent 0e5f334315
commit de0bf0663a
3 changed files with 18 additions and 0 deletions

View File

@@ -52,6 +52,7 @@
#include "table/town_land.h"
TownID _new_town_id;
uint32 _town_cargos_accepted; ///< Bitmap of all cargos accepted by houses.
/* Initialize the town-pool */
TownPool _town_pool("Town");
@@ -742,6 +743,17 @@ void UpdateTownCargos(Town *t)
UpdateTownCargoTotal(t);
}
/** Updates the bitmap of all cargos accepted by houses. */
void UpdateTownCargoBitmap()
{
Town *town;
_town_cargos_accepted = 0;
FOR_ALL_TOWNS(town) {
_town_cargos_accepted |= town->cargo_accepted_total;
}
}
static bool GrowTown(Town *t);
static void TownTickHandler(Town *t)
@@ -3143,6 +3155,8 @@ void TownsMonthlyLoop()
UpdateTownUnwanted(t);
UpdateTownCargos(t);
}
UpdateTownCargoBitmap();
}
void TownsYearlyLoop()