(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.
This commit is contained in:
tron 2004-11-21 10:49:40 +00:00
parent 75d002690a
commit 57adc97733
36 changed files with 152 additions and 135 deletions

View File

@ -523,7 +523,7 @@ uint GetSlopeTileh_Clear(TileInfo *ti)
return ti->tileh;
}
static void GetAcceptedCargo_Clear(uint tile, AcceptedCargo *ac)
static void GetAcceptedCargo_Clear(uint tile, AcceptedCargo ac)
{
/* unused */
}

View File

@ -22,7 +22,7 @@ static int32 ClearTile_Dummy(uint tile, byte flags) {
}
static void GetAcceptedCargo_Dummy(uint tile, AcceptedCargo *ac)
static void GetAcceptedCargo_Dummy(uint tile, AcceptedCargo ac)
{
/* not used */
}

View File

@ -23,7 +23,7 @@ void RunTileLoop();
uint GetPartialZ(int x, int y, int corners);
uint GetSlopeZ(int x, int y);
uint32 GetTileTrackStatus(uint tile, TransportType mode);
void GetAcceptedCargo(uint tile, AcceptedCargo *ac);
void GetAcceptedCargo(uint tile, AcceptedCargo ac);
void ChangeTileOwner(uint tile, byte old_player, byte new_player);
void AnimateTile(uint tile);
void ClickTile(uint tile);

View File

@ -339,28 +339,19 @@ static uint GetSlopeTileh_Industry(TileInfo *ti) {
return 0;
}
static void GetAcceptedCargo_Industry(uint tile, AcceptedCargo *ac)
static void GetAcceptedCargo_Industry(uint tile, AcceptedCargo ac)
{
int m5 = _map5[tile];
int a;
a = _industry_map5_accepts_1[m5];
if (a >= 0) {
ac->type_1 = a;
ac->amount_1 = (a == 0) ? 1 : 8;
}
if (a >= 0) ac[a] = (a == 0) ? 1 : 8;
a = _industry_map5_accepts_2[m5];
if (a >= 0) {
ac->type_2 = a;
ac->amount_2 = 8;
}
if (a >= 0) ac[a] = 8;
a = _industry_map5_accepts_3[m5];
if (a >= 0) {
ac->type_3 = a;
ac->amount_3 = 8;
}
if (a >= 0) ac[a] = 8;
}
static void GetTileDesc_Industry(uint tile, TileDesc *td)

View File

@ -311,7 +311,7 @@ void ChangeTileOwner(uint tile, byte old_player, byte new_player)
_tile_type_procs[GET_TILETYPE(tile)]->change_tile_owner_proc(tile, old_player, new_player);
}
void GetAcceptedCargo(uint tile, AcceptedCargo *ac)
void GetAcceptedCargo(uint tile, AcceptedCargo ac)
{
memset(ac, 0, sizeof(AcceptedCargo));
_tile_type_procs[GET_TILETYPE(tile)]->get_accepted_cargo_proc(tile, ac);

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Select Tutorial/Demonstration
STR_01CE_CARGO_ACCEPTED :{BLACK}Cargo accepted: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Cargo accepted: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Cargo accepted: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Cargo accepted: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Cargo accepted: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Seleccionar Tutorial/Demostrac
STR_01CE_CARGO_ACCEPTED :{BLACK}Càrrega acceptada: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Càrrega acceptada: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Càrrega acceptada: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Càrrega acceptada: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Càrrega acceptada: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Zvolit Tutorial/Ukazka
STR_01CE_CARGO_ACCEPTED :{BLACK}Prijimane zbozi: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Prijimane zbozi: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Prijimane zbozi: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Prijimane zbozi: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Prijimane zbozi: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}V
STR_01CE_CARGO_ACCEPTED :{BLACK}Accepteret last: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Accepteret last: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Accepteret last: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Accepteret last: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Accepteret last: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Kies uitleg/demonstratie
STR_01CE_CARGO_ACCEPTED :{BLACK}Accepteert: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Accepteert: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Accepteert: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Accepteert: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Accepteert: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Select Tutorial/Demonstration
STR_01CE_CARGO_ACCEPTED :{BLACK}Cargo accepted: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Cargo accepted: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Cargo accepted: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Cargo accepted: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Cargo accepted: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Valitse pikaohje/esitys
STR_01CE_CARGO_ACCEPTED :{BLACK}Vastaanotettava rahti: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Vastaanotettava rahti: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Vastaanotettava rahti: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Vastaanotettava rahti: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Vastaanotettava rahti: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Choisir Didacticiel/D
STR_01CE_CARGO_ACCEPTED :{BLACK}Cargaison acceptée: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Cargaison acceptée: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Cargaison acceptée: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Cargaison acceptée: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Cargaison acceptée: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -493,6 +493,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Seleccionar Tutorial/Demostrac
STR_01CE_CARGO_ACCEPTED :{BLACK}Carga aceptada: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Carga aceptada: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Carga aceptada: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Carga aceptada: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Carga aceptada: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Einf
STR_01CE_CARGO_ACCEPTED :{BLACK}Akzeptierte Fracht: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Akzeptierte Fracht: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Akzeptierte Fracht: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Akzeptierte Fracht: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Akzeptierte Fracht: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}V
STR_01CE_CARGO_ACCEPTED :{BLACK}Elfogad: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Elfogad: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Elfogad: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Elfogad: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Elfogad: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -492,6 +492,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Velja Lei
STR_01CE_CARGO_ACCEPTED :{BLACK}Tekið á móti: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Tekið á móti: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Tekið á móti: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Tekið á móti: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Tekið á móti: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Seleziona Tutorial/Demonstrazi
STR_01CE_CARGO_ACCEPTED :{BLACK}Merci accettate: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Merci accettate: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Merci accettate: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Merci accettate: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Merci accettate: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Velg veiledning/demonstrasjon
STR_01CE_CARGO_ACCEPTED :{BLACK}Akseptert gods: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Akseptert gods: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Akseptert gods: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Akseptert gods: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Akseptert gods: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Wybierz Wprowadzenie/Demo
STR_01CE_CARGO_ACCEPTED :{BLACK}Akceptowany ladunek: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Akceptowany ladunek: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Akceptowany ladunek: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Akceptowany ladunek: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Akceptowany ladunek: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Seleccionar Tutorial/Demonstra
STR_01CE_CARGO_ACCEPTED :{BLACK}Carga aceite: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Carga aceite: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Carga aceite: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Carga aceite: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Carga aceite: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Alege vizionarea unui tutorial
STR_01CE_CARGO_ACCEPTED :{BLACK}Încãrcãturi acceptate: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Încãrcãturi acceptate: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Încãrcãturi acceptate: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Încãrcãturi acceptate: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Încãrcãturi acceptate: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Vybrat Nacvik / Ukazku
STR_01CE_CARGO_ACCEPTED :{BLACK}Prijma naklad: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Prijma naklad: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Prijma naklad: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Prijma naklad: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Prijma naklad: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}Seleccionar Tutorial/Demonstra
STR_01CE_CARGO_ACCEPTED :{BLACK}Carga aceptada: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Carga aceptada: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Carga aceptada: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Carga aceptada: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Carga aceptada: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -495,6 +495,8 @@ STR_01CD_SELECT_TUTORIAL_DEMONSTRATION :{WHITE}V
STR_01CE_CARGO_ACCEPTED :{BLACK}Accepterat gods: {LTBLUE}{STRING}
STR_01CF_CARGO_ACCEPTED :{BLACK}Accepterat gods: {LTBLUE}{STRING}, {STRING}
STR_01D0_CARGO_ACCEPTED :{BLACK}Accepterat gods: {LTBLUE}{STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_4 :{BLACK}Accepterat gods: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}
STR_CARGO_ACCEPTED_5 :{BLACK}Accepterat gods: {LTBLUE}{STRING}, {STRING}, {STRING}, {STRING}, {STRING}
############ range for cargo acecpted ends
STR_01D1_8 :({COMMA8}/8 {STRING})

View File

@ -32,6 +32,8 @@ static void LandInfoWndProc(Window *w, WindowEvent *e)
uint32 *b;
if (e->event == WE_PAINT) {
int i;
DrawWindowWidgets(w);
lid = WP(w,void_d).data;
@ -68,37 +70,19 @@ static void LandInfoWndProc(Window *w, WindowEvent *e)
str = STR_01CE_CARGO_ACCEPTED - 1;
if (lid->ac.amount_1 != 0) {
if (lid->ac.amount_1 < 8) {
SET_DPARAMX16(b, 0, STR_01D1_8);
SET_DPARAMX8(b, 1, lid->ac.amount_1);
b += 2;
/* XXX if a tile accepts more cargo types than there are template strings
* this breaks */
for (i = 0; i < NUM_CARGO; ++i) {
if (lid->ac[i] > 0) {
if (lid->ac[i] < 8) {
SET_DPARAMX16(b, 0, STR_01D1_8);
SET_DPARAMX8(b, 1, lid->ac[i]);
b += 2;
}
SET_DPARAMX16(b, 0, _cargoc.names_s[i]);
b++;
str++;
}
SET_DPARAMX16(b, 0, _cargoc.names_s[lid->ac.type_1]);
b++;
str++;
}
if (lid->ac.amount_2 != 0) {
if (lid->ac.amount_2 < 8) {
SET_DPARAMX16(b, 0, STR_01D1_8);
SET_DPARAMX8(b, 1, lid->ac.amount_2);
b += 2;
}
SET_DPARAMX16(b, 0, _cargoc.names_s[lid->ac.type_2]);
b++;
str++;
}
if (lid->ac.amount_3 != 0) {
if (lid->ac.amount_3 < 8) {
SET_DPARAMX16(b, 0, STR_01D1_8);
SET_DPARAMX8(b, 1, lid->ac.amount_3);
b += 2;
}
SET_DPARAMX16(b, 0, _cargoc.names_s[lid->ac.type_3]);
b++;
str++;
}
if (str != (STR_01CE_CARGO_ACCEPTED - 1))
@ -155,7 +139,7 @@ static void Place_LandInfo(uint tile)
// Becuase build_date is not set yet in every TileDesc, we make sure it is empty
lid.td.build_date = 0;
GetAcceptedCargo(tile, &lid.ac);
GetAcceptedCargo(tile, lid.ac);
GetTileDesc(tile, &lid.td);
#if defined(_DEBUG)

View File

@ -1965,7 +1965,7 @@ uint GetSlopeTileh_Track(TileInfo *ti)
return ti->tileh;
}
static void GetAcceptedCargo_Track(uint tile, AcceptedCargo *ac)
static void GetAcceptedCargo_Track(uint tile, AcceptedCargo ac)
{
/* not used */
}

View File

@ -903,7 +903,7 @@ uint GetSlopeTileh_Road(TileInfo *ti)
return ti->tileh;
}
static void GetAcceptedCargo_Road(uint tile, AcceptedCargo *ac)
static void GetAcceptedCargo_Road(uint tile, AcceptedCargo ac)
{
/* not used */
}

View File

@ -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 */
}

View File

@ -2133,21 +2133,38 @@ static const byte _housetype_cargo_mail[110] = {
4, 4, 4, 1, 1, 2,
};
static const int8 _housetype_cargo_goods[110] = {
static const byte _housetype_cargo_goods[] = {
4, 4, 1, 0, 6, 6, 0, 2,
2, 0, 0, 0, 0, 4, 3, 3,
3, 6, 8, 6, 0, 0, 0, 0,
0, 0, 0, 2, 3, 3, 3, 2,
0, 0, 0, 0, 2,-1,-1, 2,
3, 3, 3, 3,-2,-2,-2,-2,
-2,-2, 4, 4, 4, 4, 5, 5,
-1,-1,-1,-1, 0, 0,-1,-1,
3, 3,-3, 2,-3, 2, 3, 3,
4, 4, 2, 2, 2, 2,-2,-2,
-2,-1, 1, 0,-2, 1, 1, 4,
0, 0, 0, 0, 2, 0, 0, 2,
3, 3, 3, 3, 0, 0, 0, 0,
0, 0, 4, 4, 4, 4, 5, 5,
0, 0, 0, 0, 0, 0, 0, 0,
3, 3, 0, 2, 0, 2, 3, 3,
4, 4, 2, 2, 2, 2, 0, 0,
0, 0, 1, 0, 0, 1, 1, 4,
4, 1, 4, 0, 2, 1, 2, 2,
2, 2, 2, 2, 2, 2, 1, 1,
-4,-4, 2, 2, 2,-4,
0, 0, 2, 2, 2, 0
};
static const byte _housetype_cargo_food[] = {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 1, 1, 0,
0, 0, 0, 0, 2, 2, 2, 2,
2, 2, 0, 0, 0, 0, 0, 0,
1, 1, 1, 1, 0, 0, 1, 1,
0, 0, 3, 0, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 2, 2,
2, 1, 0, 0, 2, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
4, 4, 0, 0, 0, 4
};
static const byte _house_more_flags[110] = {

View File

@ -292,22 +292,14 @@ static int32 ClearTile_Town(uint tile, byte flags)
return cost;
}
static void GetAcceptedCargo_Town(uint tile, AcceptedCargo *ac)
static void GetAcceptedCargo_Town(uint tile, AcceptedCargo ac)
{
int type = _map2[tile];
ac->type_1 = CT_PASSENGERS;
ac->amount_1 = _housetype_cargo_passengers[type];
ac->type_2 = CT_GOODS;
ac->amount_2 = _housetype_cargo_goods[type];
if (ac->amount_2 & 0x80) {
ac->amount_2 &= 0x7F;
ac->type_2 = CT_FOOD;
}
ac->type_3 = CT_MAIL;
ac->amount_3 = _housetype_cargo_mail[type];
ac[CT_PASSENGERS] = _housetype_cargo_passengers[type];
ac[CT_MAIL] = _housetype_cargo_mail[type];
ac[CT_GOODS] = _housetype_cargo_goods[type];
ac[CT_FOOD] = _housetype_cargo_food[type];
}
static void GetTileDesc_Town(uint tile, TileDesc *td)

View File

@ -357,7 +357,7 @@ static int32 ClearTile_Trees(uint tile, byte flags) {
return num * _price.remove_trees;
}
static void GetAcceptedCargo_Trees(uint tile, AcceptedCargo *ac)
static void GetAcceptedCargo_Trees(uint tile, AcceptedCargo ac)
{
/* not used */
}

88
ttd.h
View File

@ -222,11 +222,47 @@ typedef struct GameDifficulty {
int town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
} GameDifficulty;
typedef struct AcceptedCargo {
int type_1, amount_1;
int type_2, amount_2;
int type_3, amount_3;
} AcceptedCargo;
enum {
// Temperate
CT_PASSENGERS = 0,
CT_COAL = 1,
CT_MAIL = 2,
CT_OIL = 3,
CT_LIVESTOCK = 4,
CT_GOODS = 5,
CT_GRAIN = 6,
CT_WOOD = 7,
CT_IRON_ORE = 8,
CT_STEEL = 9,
CT_VALUABLES = 10,
CT_FOOD = 11,
// Arctic
CT_HILLY_UNUSED = 8,
CT_PAPER = 9,
// Tropic
CT_RUBBER = 1,
CT_FRUIT = 4,
CT_COPPER_ORE = 8,
CT_WATER = 9,
// Toyland
CT_SUGAR = 1,
CT_TOYS = 3,
CT_BATTERIES = 4,
CT_CANDY = 5,
CT_TOFFEE = 6,
CT_COLA = 7,
CT_COTTON_CANDY = 8,
CT_BUBBLES = 9,
CT_PLASTIC = 10,
CT_FIZZY_DRINKS = 11,
NUM_CARGO = 12,
};
typedef uint AcceptedCargo[NUM_CARGO];
typedef struct TileDesc {
StringID str;
@ -253,7 +289,7 @@ typedef int32 CommandProc(int x, int y, uint32 flags, uint32 p1, uint32 p2);
typedef void DrawTileProc(TileInfo *ti);
typedef uint GetSlopeZProc(TileInfo *ti);
typedef int32 ClearTileProc(uint tile, byte flags);
typedef void GetAcceptedCargoProc(uint tile, AcceptedCargo *res);
typedef void GetAcceptedCargoProc(uint tile, AcceptedCargo res);
typedef void GetTileDescProc(uint tile, TileDesc *td);
/* GetTileTrackStatusProcs return a value that contains the possible tracks
* that can be taken on a given tile by a given transport. The return value is
@ -326,46 +362,6 @@ enum {
MP_NODIRTY = 1<<15,
};
enum {
// Temperate
CT_PASSENGERS = 0,
CT_COAL = 1,
CT_MAIL = 2,
CT_OIL = 3,
CT_LIVESTOCK = 4,
CT_GOODS = 5,
CT_GRAIN = 6,
CT_WOOD = 7,
CT_IRON_ORE = 8,
CT_STEEL = 9,
CT_VALUABLES = 10,
CT_FOOD = 11,
// Arctic
CT_HILLY_UNUSED = 8,
CT_PAPER = 9,
// Tropic
CT_RUBBER = 1,
CT_FRUIT = 4,
CT_COPPER_ORE = 8,
CT_WATER = 9,
// Toyland
CT_SUGAR = 1,
CT_TOYS = 3,
CT_BATTERIES = 4,
CT_CANDY = 5,
CT_TOFFEE = 6,
CT_COLA = 7,
CT_COTTON_CANDY = 8,
CT_BUBBLES = 9,
CT_PLASTIC = 10,
CT_FIZZY_DRINKS = 11,
NUM_CARGO = 12,
};
enum {
WC_MAIN_WINDOW = 0x0,
WC_MAIN_TOOLBAR = 0x1,

View File

@ -1208,7 +1208,7 @@ static uint GetSlopeTileh_TunnelBridge(TileInfo *ti) {
}
static void GetAcceptedCargo_TunnelBridge(uint tile, AcceptedCargo *ac)
static void GetAcceptedCargo_TunnelBridge(uint tile, AcceptedCargo ac)
{
/* not used */
}

View File

@ -126,7 +126,7 @@ static int32 ClearTile_Unmovable(uint tile, byte flags)
return 0;
}
static void GetAcceptedCargo_Unmovable(uint tile, AcceptedCargo *ac)
static void GetAcceptedCargo_Unmovable(uint tile, AcceptedCargo ac)
{
byte m5 = _map5[tile];
uint level; // HQ level (depends on company performance) in the range 1..5.
@ -143,17 +143,13 @@ static void GetAcceptedCargo_Unmovable(uint tile, AcceptedCargo *ac)
// Top town building generates 10, so to make HQ interesting, the top
// type makes 20.
ac->type_1 = CT_PASSENGERS;
ac->amount_1 = level;
if (!ac->amount_1) ac->amount_1 = 1;
ac[CT_PASSENGERS] = max(1, level);
// Top town building generates 4, HQ can make up to 8. The
// proportion passengers:mail is different because such a huge
// commercial building generates unusually high amount of mail
// correspondence per physical visitor.
ac->type_2 = CT_MAIL;
ac->amount_2 = level / 2;
if (!ac->amount_2) ac->amount_2 = 1;
ac[CT_MAIL] = max(1, level / 2);
}
static const StringID _unmovable_tile_str[] = {

View File

@ -450,7 +450,7 @@ static uint GetSlopeTileh_Water(TileInfo *ti)
return ti->tileh;
}
static void GetAcceptedCargo_Water(uint tile, AcceptedCargo *ac)
static void GetAcceptedCargo_Water(uint tile, AcceptedCargo ac)
{
/* not used */
}