45       bool not_yet_constructed, uint8 initial_random_bits, uint32 watched_cargo_triggers)
 
   63   const HouseSpec *hs  = HouseSpec::Get(house_id);
 
   80     CallbackID callback, uint32 param1, uint32 param2,
 
   81     bool not_yet_constructed, uint8 initial_random_bits, uint32 watched_cargo_triggers)
 
   83   house_scope(*this, house_id, tile, town, not_yet_constructed, initial_random_bits, watched_cargo_triggers),
 
   84   town_scope(*this, town, not_yet_constructed) 
 
   89 HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid)
 
   92   for (
int i = 1; i != 
lengthof(_class_mapping); i++) {
 
  103   return HOUSE_NO_CLASS;
 
  106 void InitializeBuildingCounts()
 
  108   memset(&_building_counts, 0, 
sizeof(_building_counts));
 
  129   _building_counts.id_count[house_id]++;
 
  131   if (class_id == HOUSE_NO_CLASS) 
return;
 
  134   _building_counts.class_count[class_id]++;
 
  150   if (_building_counts.id_count[house_id] > 0) _building_counts.id_count[house_id]--;
 
  152   if (class_id == HOUSE_NO_CLASS) 
return;
 
  155   if (_building_counts.class_count[class_id] > 0) _building_counts.class_count[class_id]--;
 
  178 static uint32 GetNumHouses(
HouseID house_id, 
const Town *town)
 
  180   uint8 map_id_count, town_id_count, map_class_count, town_class_count;
 
  183   map_id_count     = 
ClampU(_building_counts.id_count[house_id], 0, 255);
 
  184   map_class_count  = 
ClampU(_building_counts.class_count[class_id], 0, 255);
 
  188   return map_class_count << 24 | town_class_count << 16 | map_id_count << 8 | town_id_count;
 
  220     const HouseSpec *hs = HouseSpec::Get(house);
 
  225       if (north_tile == nbhd->
north_tile) 
return false; 
 
  244     const HouseSpec *hs = HouseSpec::Get(house);
 
  249       if (north_tile == nbhd->
north_tile) 
return false; 
 
  268     const HouseSpec *hs = HouseSpec::Get(house);
 
  273       if (north_tile == nbhd->
north_tile) 
return false; 
 
  299   uint8 searchtype = 
GB(parameter, 6, 2);
 
  300   uint8 searchradius = 
GB(parameter, 0, 6);
 
  301   if (searchtype >= 
lengthof(search_procs)) 
return 0;  
 
  302   if (searchradius < 1) 
return 0; 
 
  305   nbhd.
hs = HouseSpec::Get(house);
 
  309   if (
CircularTileSearch(&found_tile, 2 * searchradius + 1, search_procs[searchtype], &nbhd)) {
 
  334     case 0x44: 
return GetNumHouses(this->
house_id, this->
town);
 
  354       return new_house == INVALID_HOUSE_ID ? 0 : GetNumHouses(new_house, this->
town);
 
  381       for (
Station * 
const * st_iter = sl->
Begin(); st_iter != sl->
End(); st_iter++) {
 
  403       HouseSpec *hs = HouseSpec::Get(nearby_house_id);
 
  406       if (hs->
class_id != HOUSE_NO_CLASS) {
 
  411       uint local_houseid = 0;
 
  413         local_houseid = nearby_house_id;
 
  418       return houseclass << 16 | local_houseid;
 
  429       return _house_mngr.
GetGRFID(house_id);
 
  433   DEBUG(grf, 1, 
"Unhandled house variable 0x%X", variable);
 
  440     bool not_yet_constructed, uint8 initial_random_bits, uint32 watched_cargo_triggers)
 
  445       not_yet_constructed, initial_random_bits, watched_cargo_triggers);
 
  446   return object.ResolveCallback();
 
  453   const HouseSpec *hs = HouseSpec::Get(house_id);
 
  459       palette = 
HasBit(callback, 14) ? 
GB(callback, 0, 8) + SPR_2CCMAP_BASE : callback;
 
  478   const HouseSpec *hs = HouseSpec::Get(house_id);
 
  481     bool draw_old_one = 
true;
 
  494   if (group != NULL && group->type == SGT_TILELAYOUT) {
 
  505   return GetHouseCallback(callback, param1, param2, spec - HouseSpec::Get(0), town, tile, 
false, 0, extra_data);
 
  520   if (hs == NULL) 
return;
 
  525 void AnimateNewHouseConstruction(
TileIndex tile)
 
  552 static void AnimationControl(
TileIndex tile, uint16 random_bits)
 
  571   TriggerHouse(tile, HOUSE_TRIGGER_TILE_LOOP);
 
  572   if (hs->
building_flags & BUILDING_HAS_1_TILE) TriggerHouse(tile, HOUSE_TRIGGER_TILE_LOOP_TOP);
 
  580       uint16 random = 
GB(Random(), 0, 16);
 
  582       if (hs->
building_flags & BUILDING_HAS_1_TILE)  AnimationControl(tile, random);
 
  587       AnimationControl(tile, 0);
 
  595       ClearTownHouse(Town::GetByTile(tile), tile);
 
  605 static void DoTriggerHouse(
TileIndex tile, HouseTrigger trigger, byte base_random, 
bool first)
 
  616   object.trigger = trigger;
 
  619   if (group == NULL) 
return;
 
  621   byte new_random_bits = Random();
 
  623   uint32 reseed = 
object.GetReseedSum(); 
 
  624   random_bits &= ~reseed;
 
  625   random_bits |= (first ? new_random_bits : base_random) & reseed;
 
  629     case HOUSE_TRIGGER_TILE_LOOP:
 
  633     case HOUSE_TRIGGER_TILE_LOOP_TOP:
 
  647 void TriggerHouse(
TileIndex t, HouseTrigger trigger)
 
  649   DoTriggerHouse(t, trigger, 0, 
true);
 
  662   uint32 cb_info = random << 16 | (uint8)diff.
y << 8 | (uint8)diff.
x;
 
  676   const HouseSpec *hs = HouseSpec::Get(
id);
 
  680   if (trigger_cargoes == 0) 
return;
 
  687   hs = HouseSpec::Get(
id);