diff options
-rw-r--r-- | src/ai/api/ai_tile.cpp | 8 | ||||
-rw-r--r-- | src/ai/api/ai_tilelist.cpp | 12 | ||||
-rw-r--r-- | src/cargo_type.h | 4 | ||||
-rw-r--r-- | src/depot_gui.cpp | 2 | ||||
-rw-r--r-- | src/industry_cmd.cpp | 16 | ||||
-rw-r--r-- | src/misc_gui.cpp | 24 | ||||
-rw-r--r-- | src/roadveh_gui.cpp | 2 | ||||
-rw-r--r-- | src/station_cmd.cpp | 18 | ||||
-rw-r--r-- | src/station_func.h | 4 | ||||
-rw-r--r-- | src/tile_cmd.h | 22 | ||||
-rw-r--r-- | src/town_cmd.cpp | 20 | ||||
-rw-r--r-- | src/train_gui.cpp | 8 | ||||
-rw-r--r-- | src/unmovable_cmd.cpp | 6 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 2 |
14 files changed, 74 insertions, 74 deletions
diff --git a/src/ai/api/ai_tile.cpp b/src/ai/api/ai_tile.cpp index df44cac66..c7f67f603 100644 --- a/src/ai/api/ai_tile.cpp +++ b/src/ai/api/ai_tile.cpp @@ -179,16 +179,16 @@ { if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius <= 0) return -1; - AcceptedCargo accepts; - ::GetAcceptanceAroundTiles(accepts, tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED); - return accepts[cargo_type]; + CargoArray acceptance; + ::GetAcceptanceAroundTiles(acceptance, tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED); + return acceptance[cargo_type]; } /* static */ int32 AITile::GetCargoProduction(TileIndex tile, CargoID cargo_type, int width, int height, int radius) { if (!::IsValidTile(tile) || width <= 0 || height <= 0 || radius <= 0) return -1; - AcceptedCargo produced; + CargoArray produced; ::GetProductionAroundTiles(produced, tile, width, height, _settings_game.station.modified_catchment ? radius : (int)CA_UNMODIFIED); return produced[cargo_type]; } diff --git a/src/ai/api/ai_tilelist.cpp b/src/ai/api/ai_tilelist.cpp index 8015b96f8..38b99ef9a 100644 --- a/src/ai/api/ai_tilelist.cpp +++ b/src/ai/api/ai_tilelist.cpp @@ -92,12 +92,12 @@ AITileList_IndustryAccepting::AITileList_IndustryAccepting(IndustryID industry_i /* Only add the tile if it accepts the cargo (sometimes just 1 tile of an * industry triggers the acceptance). */ - AcceptedCargo accepts; - ::GetAcceptanceAroundTiles(accepts, cur_tile, 1, 1, radius); + CargoArray acceptance; + ::GetAcceptanceAroundTiles(acceptance, cur_tile, 1, 1, radius); { bool cargo_accepts = false; for (byte j = 0; j < lengthof(i->accepts_cargo); j++) { - if (i->accepts_cargo[j] != CT_INVALID && accepts[i->accepts_cargo[j]] != 0) cargo_accepts = true; + if (i->accepts_cargo[j] != CT_INVALID && acceptance[i->accepts_cargo[j]] != 0) cargo_accepts = true; } if (!cargo_accepts) continue; } @@ -130,12 +130,12 @@ AITileList_IndustryProducing::AITileList_IndustryProducing(IndustryID industry_i /* Only add the tile if it produces the cargo (a bug in OpenTTD makes this * inconsitance). */ - AcceptedCargo produces; - ::GetProductionAroundTiles(produces, cur_tile, 1, 1, radius); + CargoArray produced; + ::GetProductionAroundTiles(produced, cur_tile, 1, 1, radius); { bool cargo_produces = false; for (byte j = 0; j < lengthof(i->produced_cargo); j++) { - if (i->produced_cargo[j] != CT_INVALID && produces[i->produced_cargo[j]] != 0) cargo_produces = true; + if (i->produced_cargo[j] != CT_INVALID && produced[i->produced_cargo[j]] != 0) cargo_produces = true; } if (!cargo_produces) continue; } diff --git a/src/cargo_type.h b/src/cargo_type.h index 57365857d..94bc9dbb6 100644 --- a/src/cargo_type.h +++ b/src/cargo_type.h @@ -55,7 +55,7 @@ enum CargoTypes { CT_INVALID = 0xFF }; -/** Array for storing amounts of accepted cargo */ -typedef uint AcceptedCargo[NUM_CARGO]; +/** Array for storing amounts of cargo */ +typedef uint CargoArray[NUM_CARGO]; #endif /* CARGO_TYPE_H */ diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index a2d4d5c66..f6c5117e4 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -847,7 +847,7 @@ struct DepotWindow : Window { if (this->type == VEH_TRAIN) v = gdvp.wagon; if (v != NULL && mode == MODE_DRAG_VEHICLE) { - AcceptedCargo capacity, loaded; + CargoArray capacity, loaded; memset(capacity, 0, sizeof(capacity)); memset(loaded, 0, sizeof(loaded)); diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 384ef4bd0..4e355c738 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -380,18 +380,18 @@ static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh) return FlatteningFoundation(tileh); } -static void AddAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac) +static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray acceptance) { IndustryGfx gfx = GetIndustryGfx(tile); const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx); /* When we have to use a callback, we put our data in the next two variables */ CargoID raw_accepts_cargo[lengthof(itspec->accepts_cargo)]; - uint8 raw_acceptance[lengthof(itspec->acceptance)]; + uint8 raw_cargo_acceptance[lengthof(itspec->acceptance)]; /* And then these will always point to a same sized array with the required data */ const CargoID *accepts_cargo = itspec->accepts_cargo; - const uint8 *acceptance = itspec->acceptance; + const uint8 *cargo_acceptance = itspec->acceptance; if (HasBit(itspec->callback_flags, CBM_INDT_ACCEPT_CARGO)) { uint16 res = GetIndustryTileCallback(CBID_INDTILE_ACCEPT_CARGO, 0, 0, gfx, GetIndustryByTile(tile), tile); @@ -404,14 +404,14 @@ static void AddAcceptedCargo_Industry(TileIndex tile, AcceptedCargo ac) if (HasBit(itspec->callback_flags, CBM_INDT_CARGO_ACCEPTANCE)) { uint16 res = GetIndustryTileCallback(CBID_INDTILE_CARGO_ACCEPTANCE, 0, 0, gfx, GetIndustryByTile(tile), tile); if (res != CALLBACK_FAILED) { - acceptance = raw_acceptance; - for (uint i = 0; i < lengthof(itspec->accepts_cargo); i++) raw_acceptance[i] = GB(res, i * 4, 4); + cargo_acceptance = raw_cargo_acceptance; + for (uint i = 0; i < lengthof(itspec->accepts_cargo); i++) raw_cargo_acceptance[i] = GB(res, i * 4, 4); } } for (byte i = 0; i < lengthof(itspec->accepts_cargo); i++) { CargoID a = accepts_cargo[i]; - if (a != CT_INVALID) ac[a] += acceptance[i]; + if (a != CT_INVALID) acceptance[a] += cargo_acceptance[i]; } } @@ -868,13 +868,13 @@ static TrackStatus GetTileTrackStatus_Industry(TileIndex tile, TransportType mod return 0; } -static void AddProducedCargo_Industry(TileIndex tile, AcceptedCargo ac) +static void AddProducedCargo_Industry(TileIndex tile, CargoArray produced) { const Industry *i = GetIndustryByTile(tile); for (uint j = 0; j < lengthof(i->produced_cargo); j++) { CargoID cargo = i->produced_cargo[j]; - if (cargo != CT_INVALID) ac[cargo]++; + if (cargo != CT_INVALID) produced[cargo]++; } } diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index 86bc8409f..bead99f04 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -129,9 +129,9 @@ public: td.grf = NULL; - AcceptedCargo ac; - memset(ac, 0, sizeof(AcceptedCargo)); - AddAcceptedCargo(tile, ac); + CargoArray acceptance; + memset(acceptance, 0, sizeof(CargoArray)); + AddAcceptedCargo(tile, acceptance); GetTileDesc(tile, &td); uint line_nr = 0; @@ -230,7 +230,7 @@ public: bool found = false; for (CargoID i = 0; i < NUM_CARGO; ++i) { - if (ac[i] > 0) { + if (acceptance[i] > 0) { /* Add a comma between each item. */ if (found) { *strp++ = ','; @@ -239,8 +239,8 @@ public: found = true; /* If the accepted value is less than 8, show it in 1/8:ths */ - if (ac[i] < 8) { - SetDParam(0, ac[i]); + if (acceptance[i] < 8) { + SetDParam(0, acceptance[i]); SetDParam(1, GetCargo(i)->name); strp = GetString(strp, STR_LAND_AREA_INFORMATION_CARGO_EIGHTS, lastof(this->landinfo_data[LAND_INFO_MULTICENTER_LINE])); } else { @@ -811,7 +811,7 @@ void GuiShowTooltips(StringID str, uint paramcount, const uint64 params[], bool } -static int DrawStationCoverageText(const AcceptedCargo cargo, +static int DrawStationCoverageText(const CargoArray cargos, int str_x, int str_y, StationCoverageType sct, bool supplies) { bool first = true; @@ -827,7 +827,7 @@ static int DrawStationCoverageText(const AcceptedCargo cargo, case SCT_ALL: break; default: NOT_REACHED(); } - if (cargo[i] >= (supplies ? 1U : 8U)) { + if (cargos[i] >= (supplies ? 1U : 8U)) { if (first) { first = false; } else { @@ -863,14 +863,14 @@ static int DrawStationCoverageText(const AcceptedCargo cargo, int DrawStationCoverageAreaText(int sx, int sy, StationCoverageType sct, int rad, bool supplies) { TileIndex tile = TileVirtXY(_thd.pos.x, _thd.pos.y); - AcceptedCargo cargo; + CargoArray cargos; if (tile < MapSize()) { if (supplies) { - GetProductionAroundTiles(cargo, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad); + GetProductionAroundTiles(cargos, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad); } else { - GetAcceptanceAroundTiles(cargo, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad); + GetAcceptanceAroundTiles(cargos, tile, _thd.size.x / TILE_SIZE, _thd.size.y / TILE_SIZE , rad); } - return DrawStationCoverageText(cargo, sx, sy, sct, supplies); + return DrawStationCoverageText(cargos, sx, sy, sct, supplies); } return sy; diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp index 19f6cec82..f81588d13 100644 --- a/src/roadveh_gui.cpp +++ b/src/roadveh_gui.cpp @@ -34,7 +34,7 @@ void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y) DrawString(left, right, y + y_offset, STR_VEHICLE_INFO_BUILT_VALUE); if (RoadVehHasArticPart(v)) { - AcceptedCargo max_cargo; + CargoArray max_cargo; StringID subtype_text[NUM_CARGO]; char capacity[512]; diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 033eb3f45..46c8428ee 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -441,10 +441,10 @@ static void ShowRejectOrAcceptNews(const Station *st, uint num_items, CargoID *c * @param h Y extent of the area * @param rad Search radius in addition to the given area */ -void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile, +void GetProductionAroundTiles(CargoArray produced, TileIndex tile, int w, int h, int rad) { - memset(produced, 0, sizeof(AcceptedCargo)); // sizeof(AcceptedCargo) != sizeof(produced) (== sizeof(uint *)) + memset(produced, 0, sizeof(CargoArray)); // sizeof(CargoArray) != sizeof(produced) (== sizeof(uint *)) int x = TileX(tile); int y = TileY(tile); @@ -478,10 +478,10 @@ void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile, * @param h Y extent of area * @param rad Search radius in addition to given area */ -void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile, +void GetAcceptanceAroundTiles(CargoArray acceptance, TileIndex tile, int w, int h, int rad) { - memset(accepts, 0, sizeof(AcceptedCargo)); // sizeof(AcceptedCargo) != sizeof(accepts) (== sizeof(uint *)) + memset(acceptance, 0, sizeof(CargoArray)); // sizeof(CargoArray) != sizeof(acceptance) (== sizeof(uint *)) int x = TileX(tile); int y = TileY(tile); @@ -501,7 +501,7 @@ void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile, for (int yc = y1; yc != y2; yc++) { for (int xc = x1; xc != x2; xc++) { TileIndex tile = TileXY(xc, yc); - AddAcceptedCargo(tile, accepts); + AddAcceptedCargo(tile, acceptance); } } } @@ -519,22 +519,22 @@ static void UpdateStationAcceptance(Station *st, bool show_msg) uint old_acc = GetAcceptanceMask(st); /* And retrieve the acceptance. */ - AcceptedCargo accepts; + CargoArray acceptance; if (!st->rect.IsEmpty()) { GetAcceptanceAroundTiles( - accepts, + acceptance, TileXY(st->rect.left, st->rect.top), st->rect.right - st->rect.left + 1, st->rect.bottom - st->rect.top + 1, st->GetCatchmentRadius() ); } else { - memset(accepts, 0, sizeof(accepts)); + memset(acceptance, 0, sizeof(acceptance)); } /* Adjust in case our station only accepts fewer kinds of goods */ for (CargoID i = 0; i < NUM_CARGO; i++) { - uint amt = min(accepts[i], 15); + uint amt = min(acceptance[i], 15); /* Make sure the station can accept the goods type. */ bool is_passengers = IsCargoInClass(i, CC_PASSENGERS); diff --git a/src/station_func.h b/src/station_func.h index 2b5fbf57d..ec7af7dd4 100644 --- a/src/station_func.h +++ b/src/station_func.h @@ -22,8 +22,8 @@ void FindStationsAroundTiles(TileIndex tile, int w_prod, int h_prod, StationList void ShowStationViewWindow(StationID station); void UpdateAllStationVirtCoord(); -void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile, int w, int h, int rad); -void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile, int w, int h, int rad); +void GetProductionAroundTiles(CargoArray produced, TileIndex tile, int w, int h, int rad); +void GetAcceptanceAroundTiles(CargoArray acceptance, TileIndex tile, int w, int h, int rad); const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx); void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image); diff --git a/src/tile_cmd.h b/src/tile_cmd.h index 6d8cb1a40..66787f303 100644 --- a/src/tile_cmd.h +++ b/src/tile_cmd.h @@ -70,11 +70,11 @@ typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y); typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlag flags); /** - * Tile callback function signature for obtaining accepted cargo of a tile - * @param tile Tile queried for its accepted cargo - * @param res Storage destination of the cargo accepted + * Tile callback function signature for obtaining cargo acceptance of a tile + * @param tile Tile queried for its accepted cargo + * @param acceptance Storage destination of the cargo acceptance in 1/8 */ -typedef void AddAcceptedCargoProc(TileIndex tile, AcceptedCargo res); +typedef void AddAcceptedCargoProc(TileIndex tile, CargoArray acceptance); /** * Tile callback function signature for obtaining a tile description @@ -100,10 +100,10 @@ typedef TrackStatus GetTileTrackStatusProc(TileIndex tile, TransportType mode, u /** * Tile callback function signature for obtaining the produced cargo of a tile. - * @param tile Tile being queried - * @param b Destination array of produced cargo + * @param tile Tile being queried + * @param produced Destination array for produced cargo */ -typedef void AddProducedCargoProc(TileIndex tile, AcceptedCargo ac); +typedef void AddProducedCargoProc(TileIndex tile, CargoArray produced); typedef bool ClickTileProc(TileIndex tile); typedef void AnimateTileProc(TileIndex tile); typedef void TileLoopProc(TileIndex tile); @@ -157,18 +157,18 @@ VehicleEnterTileStatus VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner); void GetTileDesc(TileIndex tile, TileDesc *td); -static inline void AddAcceptedCargo(TileIndex tile, AcceptedCargo ac) +static inline void AddAcceptedCargo(TileIndex tile, CargoArray acceptance) { AddAcceptedCargoProc *proc = _tile_type_procs[GetTileType(tile)]->add_accepted_cargo_proc; if (proc == NULL) return; - proc(tile, ac); + proc(tile, acceptance); } -static inline void AddProducedCargo(TileIndex tile, AcceptedCargo ac) +static inline void AddProducedCargo(TileIndex tile, CargoArray produced) { AddProducedCargoProc *proc = _tile_type_procs[GetTileType(tile)]->add_produced_cargo_proc; if (proc == NULL) return; - proc(tile, ac); + proc(tile, produced); } static inline void AnimateTile(TileIndex tile) diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index c51f5df38..d22527e5d 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -555,7 +555,7 @@ static CommandCost ClearTile_Town(TileIndex tile, DoCommandFlag flags) return cost; } -static void AddProducedCargo_Town(TileIndex tile, AcceptedCargo ac) +static void AddProducedCargo_Town(TileIndex tile, CargoArray produced) { HouseID house_id = GetHouseType(tile); const HouseSpec *hs = HouseSpec::Get(house_id); @@ -570,19 +570,19 @@ static void AddProducedCargo_Town(TileIndex tile, AcceptedCargo ac) CargoID cargo = GetCargoTranslation(GB(callback, 8, 7), hs->grffile); if (cargo == CT_INVALID) continue; - ac[cargo]++; + produced[cargo]++; } } else { if (hs->population > 0) { - ac[CT_PASSENGERS]++; + produced[CT_PASSENGERS]++; } if (hs->mail_generation > 0) { - ac[CT_MAIL]++; + produced[CT_MAIL]++; } } } -static void AddAcceptedCargo_Town(TileIndex tile, AcceptedCargo ac) +static void AddAcceptedCargo_Town(TileIndex tile, CargoArray acceptance) { const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile)); CargoID accepts[3]; @@ -607,13 +607,13 @@ static void AddAcceptedCargo_Town(TileIndex tile, AcceptedCargo ac) if (HasBit(hs->callback_mask, CBM_HOUSE_CARGO_ACCEPTANCE)) { uint16 callback = GetHouseCallback(CBID_HOUSE_CARGO_ACCEPTANCE, 0, 0, GetHouseType(tile), Town::GetByTile(tile), tile); if (callback != CALLBACK_FAILED) { - if (accepts[0] != CT_INVALID) ac[accepts[0]] += GB(callback, 0, 4); - if (accepts[1] != CT_INVALID) ac[accepts[1]] += GB(callback, 4, 4); + if (accepts[0] != CT_INVALID) acceptance[accepts[0]] += GB(callback, 0, 4); + if (accepts[1] != CT_INVALID) acceptance[accepts[1]] += GB(callback, 4, 4); if (_settings_game.game_creation.landscape != LT_TEMPERATE && HasBit(callback, 12)) { /* The 'S' bit indicates food instead of goods */ - ac[CT_FOOD] += GB(callback, 8, 4); + acceptance[CT_FOOD] += GB(callback, 8, 4); } else { - if (accepts[2] != CT_INVALID) ac[accepts[2]] += GB(callback, 8, 4); + if (accepts[2] != CT_INVALID) acceptance[accepts[2]] += GB(callback, 8, 4); } return; } @@ -621,7 +621,7 @@ static void AddAcceptedCargo_Town(TileIndex tile, AcceptedCargo ac) /* No custom acceptance, so fill in with the default values */ for (uint8 i = 0; i < lengthof(accepts); i++) { - if (accepts[i] != CT_INVALID) ac[accepts[i]] += hs->cargo_acceptance[i]; + if (accepts[i] != CT_INVALID) acceptance[accepts[i]] += hs->cargo_acceptance[i]; } } diff --git a/src/train_gui.cpp b/src/train_gui.cpp index 2ef9e786c..aded6e28d 100644 --- a/src/train_gui.cpp +++ b/src/train_gui.cpp @@ -182,8 +182,8 @@ static void TrainDetailsCapacityTab(const Vehicle *v, int left, int right, int y */ int GetTrainDetailsWndVScroll(VehicleID veh_id, TrainDetailsWindowTabs det_tab) { - AcceptedCargo act_cargo; - AcceptedCargo max_cargo; + CargoArray act_cargo; + CargoArray max_cargo; int num = 0; if (det_tab == TDW_TAB_TOTALS) { // Total cargo tab @@ -272,8 +272,8 @@ void DrawTrainDetails(const Vehicle *v, int left, int right, int y, int vscroll_ if (v == NULL) return; } } else { - AcceptedCargo act_cargo; - AcceptedCargo max_cargo; + CargoArray act_cargo; + CargoArray max_cargo; Money feeder_share = 0; memset(max_cargo, 0, sizeof(max_cargo)); diff --git a/src/unmovable_cmd.cpp b/src/unmovable_cmd.cpp index 3ddf393f3..ef2f89990 100644 --- a/src/unmovable_cmd.cpp +++ b/src/unmovable_cmd.cpp @@ -291,7 +291,7 @@ static CommandCost ClearTile_Unmovable(TileIndex tile, DoCommandFlag flags) return CommandCost(); } -static void AddAcceptedCargo_Unmovable(TileIndex tile, AcceptedCargo ac) +static void AddAcceptedCargo_Unmovable(TileIndex tile, CargoArray acceptance) { if (!IsCompanyHQ(tile)) return; @@ -303,13 +303,13 @@ static void AddAcceptedCargo_Unmovable(TileIndex tile, AcceptedCargo ac) /* Top town building generates 10, so to make HQ interesting, the top * type makes 20. */ - ac[CT_PASSENGERS] += max(1U, level); + acceptance[CT_PASSENGERS] += max(1U, 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[CT_MAIL] += max(1U, level / 2); + acceptance[CT_MAIL] += max(1U, level / 2); } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index cffd8c7ef..9d7542071 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -576,7 +576,7 @@ static int CDECL VehicleProfitLastYearSorter(const Vehicle * const *a, const Veh static int CDECL VehicleCargoSorter(const Vehicle * const *a, const Vehicle * const *b) { const Vehicle *v; - AcceptedCargo diff; + CargoArray diff; memset(diff, 0, sizeof(diff)); /* Append the cargo of the connected weagons */ |