summaryrefslogtreecommitdiff
path: root/station_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2004-11-21 10:49:40 +0000
committertron <tron@openttd.org>2004-11-21 10:49:40 +0000
commit57adc97733fc0cc226f7d8f71c7e6b62dab690e0 (patch)
tree3fa8e5167fbe6804668a83cddbd662bdb0e8de2c /station_cmd.c
parent75d002690ac43c3a1c9bdbd16ca0eb48c9a2c50e (diff)
downloadopenttd-57adc97733fc0cc226f7d8f71c7e6b62dab690e0.tar.xz
(svn r724) Remove restriction that a tile can only accept 3 cargo types.
This especially enables houses to accept passengers, mail, goods AND food. Add string templates for up to 5 cargo types for the tile info window. If more are needed just add them. Simplify (de-uglify) the logic for cargo acceptence for houses and split the goods/food table into two. The acceptance is unmodified, but accepting goods AND food is now trivially possible. The exact amounts have to be decided. This is based on Celestar's changes in the map branch plus some further bits that will be merged there soon.
Diffstat (limited to 'station_cmd.c')
-rw-r--r--station_cmd.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/station_cmd.c b/station_cmd.c
index cfaa2cd0e..f1299dca6 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -429,9 +429,8 @@ void GetAcceptanceAroundTiles(uint *accepts, uint tile, int w, int h)
int x,y;
int x1,y1,x2,y2;
int xc,yc;
- AcceptedCargo ac;
- memset(accepts, 0, NUM_CARGO * sizeof(uint));
+ memset(accepts, 0, sizeof(AcceptedCargo));
x = GET_TILE_X(tile);
y = GET_TILE_Y(tile);
@@ -454,10 +453,12 @@ void GetAcceptanceAroundTiles(uint *accepts, uint tile, int w, int h)
do {
uint tile = TILE_XY(xc, yc);
if (!IS_TILETYPE(tile, MP_STATION)) {
- GetAcceptedCargo(tile, &ac);
- accepts[ac.type_1] += ac.amount_1;
- accepts[ac.type_2] += ac.amount_2;
- accepts[ac.type_3] += ac.amount_3;
+ AcceptedCargo ac;
+ int i;
+
+ GetAcceptedCargo(tile, ac);
+ for (i = 0; i < NUM_CARGO; ++i)
+ accepts[i] += ac[i];
}
} while (++xc != x2);
} while (++yc != y2);
@@ -1999,7 +2000,7 @@ static uint GetSlopeTileh_Station(TileInfo *ti)
return 0;
}
-static void GetAcceptedCargo_Station(uint tile, AcceptedCargo *ac)
+static void GetAcceptedCargo_Station(uint tile, AcceptedCargo ac)
{
/* not used */
}