From b82ed41a1925803dde29d7e03cf113808faa93d3 Mon Sep 17 00:00:00 2001 From: belugas Date: Tue, 20 Mar 2007 02:24:14 +0000 Subject: (svn r9366) -Codechange: Unify the different houses acceptances attributes on their cargo counterpart, as well as specifying cargo slot. --- src/newgrf.cpp | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'src/newgrf.cpp') diff --git a/src/newgrf.cpp b/src/newgrf.cpp index 7323a0107..84f0bfcc0 100644 --- a/src/newgrf.cpp +++ b/src/newgrf.cpp @@ -1293,21 +1293,19 @@ static bool TownHouseChangeInfo(uint hid, int numinfo, int prop, byte **bufp, in break; case 0x0D: // Passenger acceptance - FOR_EACH_OBJECT housespec[i]->passenger_acceptance = grf_load_byte(&buf); - break; - case 0x0E: // Mail acceptance - FOR_EACH_OBJECT housespec[i]->mail_acceptance = grf_load_byte(&buf); + FOR_EACH_OBJECT housespec[i]->cargo_acceptance[prop - 0x0D] = grf_load_byte(&buf); break; - - case 0x0F: // Goods, food or fizzy drinks acceptance + case 0x0F: // Goods/candy, food/fizzy drinks acceptance FOR_EACH_OBJECT { int8 goods = grf_load_byte(&buf); - if (goods > 0) { - housespec[i]->goods_acceptance = goods; - } else { - housespec[i]->food_acceptance = -goods; - } + + /* If value of goods is negative, it means in fact food or, if in toyland, fizzy_drink acceptance. + * Else, we have "standard" 3rd cargo type, goods or candy, for toyland once more */ + housespec[i]->accepts_cargo[2] = (goods >= 0) ? ((_opt.landscape == LT_CANDY) ? CT_CANDY : CT_GOODS) : + ((_opt.landscape == LT_CANDY) ? CT_FIZZY_DRINKS : CT_FOOD); + + housespec[i]->cargo_acceptance[2] = abs(goods); // but we do need positive value here } break; -- cgit v1.2.3-54-g00ecf