summaryrefslogtreecommitdiff
path: root/src/newgrf.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-03-20 02:24:14 +0000
committerbelugas <belugas@openttd.org>2007-03-20 02:24:14 +0000
commitb82ed41a1925803dde29d7e03cf113808faa93d3 (patch)
treed1b31c1b0ec3ddd9a491d8e31480d12dc5ac7141 /src/newgrf.cpp
parent1bea18b440639b7e3a4e723eb88fbb5c4be8ef3d (diff)
downloadopenttd-b82ed41a1925803dde29d7e03cf113808faa93d3.tar.xz
(svn r9366) -Codechange: Unify the different houses acceptances attributes on their cargo counterpart, as well as specifying cargo slot.
Diffstat (limited to 'src/newgrf.cpp')
-rw-r--r--src/newgrf.cpp20
1 files changed, 9 insertions, 11 deletions
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;