diff options
author | peter1138 <peter1138@openttd.org> | 2007-04-13 21:18:48 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-04-13 21:18:48 +0000 |
commit | 13de7f229e6b49468c1049396d668bebe29ee6f2 (patch) | |
tree | f8e40defa57dea8ae4ebfbd5806cf74a3310d9c5 /src | |
parent | ed8a66e3d187f95cfe026cf797839e5db631a620 (diff) | |
download | openttd-13de7f229e6b49468c1049396d668bebe29ee6f2.tar.xz |
(svn r9621) -Codechange: implement newgrf house property 1E (cargo types)
Diffstat (limited to 'src')
-rw-r--r-- | src/newgrf.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/newgrf.cpp b/src/newgrf.cpp index fcfa39a41..7bb24f3b0 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -1403,8 +1403,25 @@ static bool TownHouseChangeInfo(uint hid, int numinfo, int prop, byte **bufp, in break; case 0x1E: // Accepted cargo types - FOR_EACH_OBJECT grf_load_dword(&buf); - ret = true; + FOR_EACH_OBJECT { + uint32 cargotypes = grf_load_dword(&buf); + + /* Check if the cargo types should not be changed */ + if (cargotypes == 0xFFFFFFFF) break; + + for (uint j = 0; j < 3; j++) { + /* Get the cargo number from the 'list' */ + uint8 cargo_part = GB(cargotypes, 8 * j, 8); + CargoID cargo = GetCargoTranslation(cargo_part, _cur_grffile); + + if (cargo == CT_INVALID) { + /* Disable acceptance of invalid cargo type */ + housespec[i]->cargo_acceptance[j] = 0; + } else { + housespec[i]->accepts_cargo[j] = cargo; + } + } + } break; default: |