00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #include "stdafx.h"
00013 #include "openttd.h"
00014 #include "variables.h"
00015 #include "debug.h"
00016 #include "viewport_func.h"
00017 #include "landscape.h"
00018 #include "sprite.h"
00019 #include "newgrf.h"
00020 #include "newgrf_house.h"
00021 #include "newgrf_spritegroup.h"
00022 #include "newgrf_town.h"
00023 #include "newgrf_sound.h"
00024 #include "newgrf_commons.h"
00025 #include "transparency.h"
00026 #include "functions.h"
00027 #include "company_func.h"
00028 #include "animated_tile_func.h"
00029 #include "company_base.h"
00030 #include "town.h"
00031
00032 static BuildingCounts<uint32> _building_counts;
00033 static HouseClassMapping _class_mapping[HOUSE_CLASS_MAX];
00034
00035 HouseOverrideManager _house_mngr(NEW_HOUSE_OFFSET, HOUSE_MAX, INVALID_HOUSE_ID);
00036
00037 HouseClassID AllocateHouseClassID(byte grf_class_id, uint32 grfid)
00038 {
00039
00040 for (int i = 1; i != lengthof(_class_mapping); i++) {
00041 HouseClassMapping *map = &_class_mapping[i];
00042
00043 if (map->class_id == grf_class_id && map->grfid == grfid) return (HouseClassID)i;
00044
00045 if (map->class_id == 0 && map->grfid == 0) {
00046 map->class_id = grf_class_id;
00047 map->grfid = grfid;
00048 return (HouseClassID)i;
00049 }
00050 }
00051 return HOUSE_NO_CLASS;
00052 }
00053
00054 void InitializeBuildingCounts()
00055 {
00056 memset(&_building_counts, 0, sizeof(_building_counts));
00057 }
00058
00065 void IncreaseBuildingCount(Town *t, HouseID house_id)
00066 {
00067 HouseClassID class_id = HouseSpec::Get(house_id)->class_id;
00068
00069 if (!_loaded_newgrf_features.has_newhouses) return;
00070
00071 t->building_counts.id_count[house_id]++;
00072 _building_counts.id_count[house_id]++;
00073
00074 if (class_id == HOUSE_NO_CLASS) return;
00075
00076 t->building_counts.class_count[class_id]++;
00077 _building_counts.class_count[class_id]++;
00078 }
00079
00086 void DecreaseBuildingCount(Town *t, HouseID house_id)
00087 {
00088 HouseClassID class_id = HouseSpec::Get(house_id)->class_id;
00089
00090 if (!_loaded_newgrf_features.has_newhouses) return;
00091
00092 if (t->building_counts.id_count[house_id] > 0) t->building_counts.id_count[house_id]--;
00093 if (_building_counts.id_count[house_id] > 0) _building_counts.id_count[house_id]--;
00094
00095 if (class_id == HOUSE_NO_CLASS) return;
00096
00097 if (t->building_counts.class_count[class_id] > 0) t->building_counts.class_count[class_id]--;
00098 if (_building_counts.class_count[class_id] > 0) _building_counts.class_count[class_id]--;
00099 }
00100
00101 static uint32 HouseGetRandomBits(const ResolverObject *object)
00102 {
00103 const TileIndex tile = object->u.house.tile;
00104 return (tile == INVALID_TILE || !IsTileType(tile, MP_HOUSE)) ? 0 : GetHouseRandomBits(tile);
00105 }
00106
00107 static uint32 HouseGetTriggers(const ResolverObject *object)
00108 {
00109 const TileIndex tile = object->u.house.tile;
00110 return (tile == INVALID_TILE || !IsTileType(tile, MP_HOUSE)) ? 0 : GetHouseTriggers(tile);
00111 }
00112
00113 static void HouseSetTriggers(const ResolverObject *object, int triggers)
00114 {
00115 const TileIndex tile = object->u.house.tile;
00116 if (IsTileType(tile, MP_HOUSE)) SetHouseTriggers(tile, triggers);
00117 }
00118
00119 static uint32 GetNumHouses(HouseID house_id, const Town *town)
00120 {
00121 uint8 map_id_count, town_id_count, map_class_count, town_class_count;
00122 HouseClassID class_id = HouseSpec::Get(house_id)->class_id;
00123
00124 map_id_count = ClampU(_building_counts.id_count[house_id], 0, 255);
00125 map_class_count = ClampU(_building_counts.class_count[class_id], 0, 255);
00126 town_id_count = ClampU(town->building_counts.id_count[house_id], 0, 255);
00127 town_class_count = ClampU(town->building_counts.class_count[class_id], 0, 255);
00128
00129 return map_class_count << 24 | town_class_count << 16 | map_id_count << 8 | town_id_count;
00130 }
00131
00132 uint32 GetNearbyTileInformation(byte parameter, TileIndex tile)
00133 {
00134 tile = GetNearbyTile(parameter, tile);
00135 return GetNearbyTileInformation(tile);
00136 }
00137
00139 typedef struct {
00140 const HouseSpec *hs;
00141 TileIndex north_tile;
00142 } SearchNearbyHouseData;
00143
00149 static bool SearchNearbyHouseID(TileIndex tile, void *user_data)
00150 {
00151 if (IsTileType(tile, MP_HOUSE)) {
00152 HouseID house = GetHouseType(tile);
00153 const HouseSpec *hs = HouseSpec::Get(house);
00154 if (hs->grffile != NULL) {
00155 SearchNearbyHouseData *nbhd = (SearchNearbyHouseData *)user_data;
00156
00157 TileIndex north_tile = tile + GetHouseNorthPart(house);
00158 if (north_tile == nbhd->north_tile) return false;
00159
00160 return hs->local_id == nbhd->hs->local_id &&
00161 hs->grffile->grfid == nbhd->hs->grffile->grfid;
00162 }
00163 }
00164 return false;
00165 }
00166
00172 static bool SearchNearbyHouseClass(TileIndex tile, void *user_data)
00173 {
00174 if (IsTileType(tile, MP_HOUSE)) {
00175 HouseID house = GetHouseType(tile);
00176 const HouseSpec *hs = HouseSpec::Get(house);
00177 if (hs->grffile != NULL) {
00178 SearchNearbyHouseData *nbhd = (SearchNearbyHouseData *)user_data;
00179
00180 TileIndex north_tile = tile + GetHouseNorthPart(house);
00181 if (north_tile == nbhd->north_tile) return false;
00182
00183 return hs->class_id == nbhd->hs->class_id &&
00184 hs->grffile->grfid == nbhd->hs->grffile->grfid;
00185 }
00186 }
00187 return false;
00188 }
00189
00195 static bool SearchNearbyHouseGRFID(TileIndex tile, void *user_data)
00196 {
00197 if (IsTileType(tile, MP_HOUSE)) {
00198 HouseID house = GetHouseType(tile);
00199 const HouseSpec *hs = HouseSpec::Get(house);
00200 if (hs->grffile != NULL) {
00201 SearchNearbyHouseData *nbhd = (SearchNearbyHouseData *)user_data;
00202
00203 TileIndex north_tile = tile + GetHouseNorthPart(house);
00204 if (north_tile == nbhd->north_tile) return false;
00205
00206 return hs->grffile->grfid == nbhd->hs->grffile->grfid;
00207 }
00208 }
00209 return false;
00210 }
00211
00221 static uint32 GetDistanceFromNearbyHouse(uint8 parameter, TileIndex tile, HouseID house)
00222 {
00223 static TestTileOnSearchProc * const search_procs[3] = {
00224 SearchNearbyHouseID,
00225 SearchNearbyHouseClass,
00226 SearchNearbyHouseGRFID,
00227 };
00228 TileIndex found_tile = tile;
00229 uint8 searchtype = GB(parameter, 6, 2);
00230 uint8 searchradius = GB(parameter, 0, 6);
00231 if (searchtype >= lengthof(search_procs)) return 0;
00232 if (searchradius < 1) return 0;
00233
00234 SearchNearbyHouseData nbhd;
00235 nbhd.hs = HouseSpec::Get(house);
00236 nbhd.north_tile = tile + GetHouseNorthPart(house);
00237
00238
00239 if (CircularTileSearch(&found_tile, 2 * searchradius + 1, search_procs[searchtype], &nbhd)) {
00240 return DistanceManhattan(found_tile, tile);
00241 }
00242 return 0;
00243 }
00244
00250 static uint32 HouseGetVariable(const ResolverObject *object, byte variable, byte parameter, bool *available)
00251 {
00252 const Town *town = object->u.house.town;
00253 TileIndex tile = object->u.house.tile;
00254 HouseID house_id = object->u.house.house_id;
00255
00256 if (object->scope == VSG_SCOPE_PARENT) {
00257 return TownGetVariable(variable, parameter, available, town);
00258 }
00259
00260 switch (variable) {
00261
00262 case 0x40: return (IsTileType(tile, MP_HOUSE) ? GetHouseBuildingStage(tile) : 0) | TileHash2Bit(TileX(tile), TileY(tile)) << 2;
00263
00264
00265 case 0x41: return IsTileType(tile, MP_HOUSE) ? GetHouseAge(tile) : 0;
00266
00267
00268 case 0x42: return GetTownRadiusGroup(town, tile);
00269
00270
00271 case 0x43: return GetTerrainType(tile);
00272
00273
00274 case 0x44: return GetNumHouses(house_id, town);
00275
00276
00277 case 0x45: return _generating_world ? 1 : 0;
00278
00279
00280 case 0x46: return IsTileType(tile, MP_HOUSE) ? GetHouseAnimationFrame(tile) : 0;
00281
00282
00283 case 0x47: return TileY(tile) << 16 | TileX(tile);
00284
00285
00286 case 0x60: return GetNumHouses(parameter, town);
00287
00288
00289 case 0x61: {
00290 const HouseSpec *hs = HouseSpec::Get(house_id);
00291 if (hs->grffile == NULL) return 0;
00292
00293 HouseID new_house = _house_mngr.GetID(parameter, hs->grffile->grfid);
00294 return new_house == INVALID_HOUSE_ID ? 0 : GetNumHouses(new_house, town);
00295 }
00296
00297
00298 case 0x62: return GetNearbyTileInformation(parameter, tile);
00299
00300
00301 case 0x63: {
00302 TileIndex testtile = GetNearbyTile(parameter, tile);
00303 return IsTileType(testtile, MP_HOUSE) ? GetHouseAnimationFrame(testtile) : 0;
00304 }
00305
00306
00307
00308
00309
00310 case 0x65: return GetDistanceFromNearbyHouse(parameter, tile, object->u.house.house_id);
00311 }
00312
00313 DEBUG(grf, 1, "Unhandled house property 0x%X", variable);
00314
00315 *available = false;
00316 return UINT_MAX;
00317 }
00318
00319 static const SpriteGroup *HouseResolveReal(const ResolverObject *object, const RealSpriteGroup *group)
00320 {
00321
00322 return NULL;
00323 }
00324
00330 static void NewHouseResolver(ResolverObject *res, HouseID house_id, TileIndex tile, Town *town)
00331 {
00332 res->GetRandomBits = HouseGetRandomBits;
00333 res->GetTriggers = HouseGetTriggers;
00334 res->SetTriggers = HouseSetTriggers;
00335 res->GetVariable = HouseGetVariable;
00336 res->ResolveReal = HouseResolveReal;
00337
00338 res->u.house.tile = tile;
00339 res->u.house.town = town;
00340 res->u.house.house_id = house_id;
00341
00342 res->callback = CBID_NO_CALLBACK;
00343 res->callback_param1 = 0;
00344 res->callback_param2 = 0;
00345 res->last_value = 0;
00346 res->trigger = 0;
00347 res->reseed = 0;
00348 res->count = 0;
00349
00350 const HouseSpec *hs = HouseSpec::Get(house_id);
00351 res->grffile = (hs != NULL ? hs->grffile : NULL);
00352 }
00353
00354 uint16 GetHouseCallback(CallbackID callback, uint32 param1, uint32 param2, HouseID house_id, Town *town, TileIndex tile)
00355 {
00356 ResolverObject object;
00357 const SpriteGroup *group;
00358
00359 NewHouseResolver(&object, house_id, tile, town);
00360 object.callback = callback;
00361 object.callback_param1 = param1;
00362 object.callback_param2 = param2;
00363
00364 group = SpriteGroup::Resolve(HouseSpec::Get(house_id)->spritegroup, &object);
00365 if (group == NULL) return CALLBACK_FAILED;
00366
00367 return group->GetCallbackResult();
00368 }
00369
00370 static void DrawTileLayout(const TileInfo *ti, const TileLayoutSpriteGroup *group, byte stage, HouseID house_id)
00371 {
00372 const DrawTileSprites *dts = group->dts;
00373 const DrawTileSeqStruct *dtss;
00374
00375 const HouseSpec *hs = HouseSpec::Get(house_id);
00376 SpriteID palette = hs->random_colour[TileHash2Bit(ti->x, ti->y)] + PALETTE_RECOLOUR_START;
00377 if (HasBit(hs->callback_mask, CBM_HOUSE_COLOUR)) {
00378 uint16 callback = GetHouseCallback(CBID_HOUSE_COLOUR, 0, 0, house_id, Town::GetByTile(ti->tile), ti->tile);
00379 if (callback != CALLBACK_FAILED) {
00380
00381 palette = HasBit(callback, 14) ? GB(callback, 0, 8) + SPR_2CCMAP_BASE : callback;
00382 }
00383 }
00384
00385 SpriteID image = dts->ground.sprite;
00386 SpriteID pal = dts->ground.pal;
00387
00388 if (IS_CUSTOM_SPRITE(image)) image += stage;
00389
00390 if (GB(image, 0, SPRITE_WIDTH) != 0) {
00391 DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, palette));
00392 }
00393
00394 foreach_draw_tile_seq(dtss, dts->seq) {
00395 if (GB(dtss->image.sprite, 0, SPRITE_WIDTH) == 0) continue;
00396
00397 image = dtss->image.sprite;
00398 pal = dtss->image.pal;
00399
00400
00401 if (IsInvisibilitySet(TO_HOUSES) && !HasBit(image, SPRITE_MODIFIER_OPAQUE)) return;
00402
00403 if (IS_CUSTOM_SPRITE(image)) image += stage;
00404
00405 pal = SpriteLayoutPaletteTransform(image, pal, palette);
00406
00407 if ((byte)dtss->delta_z != 0x80) {
00408 AddSortableSpriteToDraw(
00409 image, pal,
00410 ti->x + dtss->delta_x, ti->y + dtss->delta_y,
00411 dtss->size_x, dtss->size_y,
00412 dtss->size_z, ti->z + dtss->delta_z,
00413 !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_HOUSES)
00414 );
00415 } else {
00416
00417 AddChildSpriteScreen(image, pal, (byte)dtss->delta_x, (byte)dtss->delta_y, !HasBit(image, SPRITE_MODIFIER_OPAQUE) && IsTransparencySet(TO_HOUSES));
00418 }
00419 }
00420 }
00421
00422 void DrawNewHouseTile(TileInfo *ti, HouseID house_id)
00423 {
00424 const HouseSpec *hs = HouseSpec::Get(house_id);
00425 const SpriteGroup *group;
00426 ResolverObject object;
00427
00428 if (ti->tileh != SLOPE_FLAT) {
00429 bool draw_old_one = true;
00430 if (HasBit(hs->callback_mask, CBM_HOUSE_DRAW_FOUNDATIONS)) {
00431
00432 uint32 callback_res = GetHouseCallback(CBID_HOUSE_DRAW_FOUNDATIONS, 0, 0, house_id, Town::GetByTile(ti->tile), ti->tile);
00433 draw_old_one = (callback_res != 0);
00434 }
00435
00436 if (draw_old_one) DrawFoundation(ti, FOUNDATION_LEVELED);
00437 }
00438
00439 NewHouseResolver(&object, house_id, ti->tile, Town::GetByTile(ti->tile));
00440
00441 group = SpriteGroup::Resolve(hs->spritegroup, &object);
00442 const TileLayoutSpriteGroup *tlgroup = (const TileLayoutSpriteGroup *)group;
00443 if (group == NULL || group->type != SGT_TILELAYOUT || tlgroup->num_building_stages == 0) {
00444 return;
00445 } else {
00446
00447 byte stage = GetHouseBuildingStage(ti->tile);
00448 stage = Clamp(stage - 4 + tlgroup->num_building_stages, 0, tlgroup->num_building_stages - 1);
00449 DrawTileLayout(ti, tlgroup, stage, house_id);
00450 }
00451 }
00452
00453 void AnimateNewHouseTile(TileIndex tile)
00454 {
00455 const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile));
00456 byte animation_speed = hs->animation_speed;
00457 bool frame_set_by_callback = false;
00458
00459 if (HasBit(hs->callback_mask, CBM_HOUSE_ANIMATION_SPEED)) {
00460 uint16 callback_res = GetHouseCallback(CBID_HOUSE_ANIMATION_SPEED, 0, 0, GetHouseType(tile), Town::GetByTile(tile), tile);
00461 if (callback_res != CALLBACK_FAILED) animation_speed = Clamp(callback_res & 0xFF, 2, 16);
00462 }
00463
00464
00465
00466
00467
00468 if (_tick_counter % (1 << animation_speed) != 0) return;
00469
00470 byte frame = GetHouseAnimationFrame(tile);
00471 byte num_frames = GB(hs->animation_frames, 0, 7);
00472
00473 if (HasBit(hs->callback_mask, CBM_HOUSE_ANIMATION_NEXT_FRAME)) {
00474 uint32 param = (hs->extra_flags & CALLBACK_1A_RANDOM_BITS) ? Random() : 0;
00475 uint16 callback_res = GetHouseCallback(CBID_HOUSE_ANIMATION_NEXT_FRAME, param, 0, GetHouseType(tile), Town::GetByTile(tile), tile);
00476
00477 if (callback_res != CALLBACK_FAILED) {
00478 frame_set_by_callback = true;
00479
00480 switch (callback_res & 0xFF) {
00481 case 0xFF:
00482 DeleteAnimatedTile(tile);
00483 break;
00484 case 0xFE:
00485
00486 frame_set_by_callback = false;
00487 break;
00488 default:
00489 frame = callback_res & 0xFF;
00490 break;
00491 }
00492
00493
00494
00495 if (GB(callback_res, 8, 7) != 0) PlayTileSound(hs->grffile, GB(callback_res, 8, 7), tile);
00496 }
00497 }
00498
00499 if (!frame_set_by_callback) {
00500 if (frame < num_frames) {
00501 frame++;
00502 } else if (frame == num_frames && HasBit(hs->animation_frames, 7)) {
00503
00504 frame = 0;
00505 } else {
00506
00507 DeleteAnimatedTile(tile);
00508 }
00509 }
00510
00511 SetHouseAnimationFrame(tile, frame);
00512 MarkTileDirtyByTile(tile);
00513 }
00514
00515 void ChangeHouseAnimationFrame(const GRFFile *file, TileIndex tile, uint16 callback_result)
00516 {
00517 switch (callback_result & 0xFF) {
00518 case 0xFD: break;
00519 case 0xFE: AddAnimatedTile(tile); break;
00520 case 0xFF: DeleteAnimatedTile(tile); break;
00521 default:
00522 SetHouseAnimationFrame(tile, callback_result & 0xFF);
00523 AddAnimatedTile(tile);
00524 break;
00525 }
00526
00527
00528 if (GB(callback_result, 8, 7) != 0) PlayTileSound(file, GB(callback_result, 8, 7), tile);
00529 }
00530
00531 bool CanDeleteHouse(TileIndex tile)
00532 {
00533 const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile));
00534
00535
00536
00537 if (Company::IsValidHumanID(_current_company) || _current_company == OWNER_WATER || _current_company == OWNER_NONE) {
00538 return true;
00539 }
00540
00541 if (HasBit(hs->callback_mask, CBM_HOUSE_DENY_DESTRUCTION)) {
00542 uint16 callback_res = GetHouseCallback(CBID_HOUSE_DENY_DESTRUCTION, 0, 0, GetHouseType(tile), Town::GetByTile(tile), tile);
00543 return (callback_res == CALLBACK_FAILED || callback_res == 0);
00544 } else {
00545 return !(hs->extra_flags & BUILDING_IS_PROTECTED);
00546 }
00547 }
00548
00549 static void AnimationControl(TileIndex tile, uint16 random_bits)
00550 {
00551 const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile));
00552
00553 if (HasBit(hs->callback_mask, CBM_HOUSE_ANIMATION_START_STOP)) {
00554 uint32 param = (hs->extra_flags & SYNCHRONISED_CALLBACK_1B) ? (GB(Random(), 0, 16) | random_bits << 16) : Random();
00555 uint16 callback_res = GetHouseCallback(CBID_HOUSE_ANIMATION_START_STOP, param, 0, GetHouseType(tile), Town::GetByTile(tile), tile);
00556
00557 if (callback_res != CALLBACK_FAILED) ChangeHouseAnimationFrame(hs->grffile, tile, callback_res);
00558 }
00559 }
00560
00561 bool NewHouseTileLoop(TileIndex tile)
00562 {
00563 const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile));
00564
00565 if (GetHouseProcessingTime(tile) > 0) {
00566 DecHouseProcessingTime(tile);
00567 return true;
00568 }
00569
00570 TriggerHouse(tile, HOUSE_TRIGGER_TILE_LOOP);
00571 if (hs->building_flags & BUILDING_HAS_1_TILE) TriggerHouse(tile, HOUSE_TRIGGER_TILE_LOOP_TOP);
00572
00573 if (HasBit(hs->callback_mask, CBM_HOUSE_ANIMATION_START_STOP)) {
00574
00575
00576
00577
00578 if (hs->extra_flags & SYNCHRONISED_CALLBACK_1B) {
00579 uint16 random = GB(Random(), 0, 16);
00580
00581 if (hs->building_flags & BUILDING_HAS_1_TILE) AnimationControl(tile, random);
00582 if (hs->building_flags & BUILDING_2_TILES_Y) AnimationControl(TILE_ADDXY(tile, 0, 1), random);
00583 if (hs->building_flags & BUILDING_2_TILES_X) AnimationControl(TILE_ADDXY(tile, 1, 0), random);
00584 if (hs->building_flags & BUILDING_HAS_4_TILES) AnimationControl(TILE_ADDXY(tile, 1, 1), random);
00585 } else {
00586 AnimationControl(tile, 0);
00587 }
00588 }
00589
00590
00591 if (HasBit(hs->callback_mask, CBM_HOUSE_DESTRUCTION)) {
00592 uint16 callback_res = GetHouseCallback(CBID_HOUSE_DESTRUCTION, 0, 0, GetHouseType(tile), Town::GetByTile(tile), tile);
00593 if (callback_res != CALLBACK_FAILED && GB(callback_res, 0, 8) > 0) {
00594 ClearTownHouse(Town::GetByTile(tile), tile);
00595 return false;
00596 }
00597 }
00598
00599 SetHouseProcessingTime(tile, hs->processing_time);
00600 MarkTileDirtyByTile(tile);
00601 return true;
00602 }
00603
00604 static void DoTriggerHouse(TileIndex tile, HouseTrigger trigger, byte base_random, bool first)
00605 {
00606 ResolverObject object;
00607
00608
00609 assert(IsTileType(tile, MP_HOUSE));
00610
00611 HouseID hid = GetHouseType(tile);
00612 HouseSpec *hs = HouseSpec::Get(hid);
00613
00614 if (hs->spritegroup == NULL) return;
00615
00616 NewHouseResolver(&object, hid, tile, Town::GetByTile(tile));
00617
00618 object.callback = CBID_RANDOM_TRIGGER;
00619 object.trigger = trigger;
00620
00621 const SpriteGroup *group = SpriteGroup::Resolve(hs->spritegroup, &object);
00622 if (group == NULL) return;
00623
00624 byte new_random_bits = Random();
00625 byte random_bits = GetHouseRandomBits(tile);
00626 random_bits &= ~object.reseed;
00627 random_bits |= (first ? new_random_bits : base_random) & object.reseed;
00628 SetHouseRandomBits(tile, random_bits);
00629
00630 switch (trigger) {
00631 case HOUSE_TRIGGER_TILE_LOOP:
00632
00633 break;
00634
00635 case HOUSE_TRIGGER_TILE_LOOP_TOP:
00636 if (!first) {
00637
00638 MarkTileDirtyByTile(tile);
00639 break;
00640 }
00641
00642 if (hs->building_flags & BUILDING_2_TILES_Y) DoTriggerHouse(TILE_ADDXY(tile, 0, 1), trigger, random_bits, false);
00643 if (hs->building_flags & BUILDING_2_TILES_X) DoTriggerHouse(TILE_ADDXY(tile, 1, 0), trigger, random_bits, false);
00644 if (hs->building_flags & BUILDING_HAS_4_TILES) DoTriggerHouse(TILE_ADDXY(tile, 1, 1), trigger, random_bits, false);
00645 break;
00646 }
00647 }
00648
00649 void TriggerHouse(TileIndex t, HouseTrigger trigger)
00650 {
00651 DoTriggerHouse(t, trigger, 0, true);
00652 }