(svn r19744) -Add [FS#3477]: [NewGRF] Access to random bits of houses and industries from construction callbacks 17, 28 and 2F. That is: The randombits the house/industry will start with, if construction succeeds.

This commit is contained in:
frosch
2010-05-01 13:09:49 +00:00
parent 7795303227
commit 910aade284
9 changed files with 40 additions and 23 deletions

View File

@@ -2164,8 +2164,10 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
/* 1x1 house checks are already done */
}
byte random_bits = Random();
if (HasBit(hs->callback_mask, CBM_HOUSE_ALLOW_CONSTRUCTION)) {
uint16 callback_res = GetHouseCallback(CBID_HOUSE_ALLOW_CONSTRUCTION, 0, 0, house, t, tile, true);
uint16 callback_res = GetHouseCallback(CBID_HOUSE_ALLOW_CONSTRUCTION, 0, 0, house, t, tile, true, random_bits);
if (callback_res != CALLBACK_FAILED && GB(callback_res, 0, 8) == 0) continue;
}
@@ -2191,7 +2193,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile)
}
}
MakeTownHouse(tile, t, construction_counter, construction_stage, house, Random());
MakeTownHouse(tile, t, construction_counter, construction_stage, house, random_bits);
return true;
}