mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r17589) -Codechange: rename town_acc to always_accepted
This commit is contained in:
parent
2049d60e34
commit
9225b3ba03
|
@ -933,7 +933,7 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, Ti
|
||||||
uint accepted = DeliverGoodsToIndustry(st, cargo_type, num_pieces, src_type == ST_INDUSTRY ? src : INVALID_INDUSTRY);
|
uint accepted = DeliverGoodsToIndustry(st, cargo_type, num_pieces, src_type == ST_INDUSTRY ? src : INVALID_INDUSTRY);
|
||||||
|
|
||||||
/* If there are non-industries around accepting the cargo, accept it all */
|
/* If there are non-industries around accepting the cargo, accept it all */
|
||||||
if (HasBit(st->town_acc, cargo_type)) accepted = num_pieces;
|
if (HasBit(st->always_accepted, cargo_type)) accepted = num_pieces;
|
||||||
|
|
||||||
/* Determine profit */
|
/* Determine profit */
|
||||||
Money profit = GetTransportedGoodsIncome(accepted, DistanceManhattan(source_tile, st->xy), days_in_transit, cargo_type);
|
Money profit = GetTransportedGoodsIncome(accepted, DistanceManhattan(source_tile, st->xy), days_in_transit, cargo_type);
|
||||||
|
|
|
@ -400,7 +400,7 @@ static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh)
|
||||||
return FlatteningFoundation(tileh);
|
return FlatteningFoundation(tileh);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, uint32 *town_acc)
|
static void AddAcceptedCargo_Industry(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted)
|
||||||
{
|
{
|
||||||
IndustryGfx gfx = GetIndustryGfx(tile);
|
IndustryGfx gfx = GetIndustryGfx(tile);
|
||||||
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
|
const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx);
|
||||||
|
|
|
@ -326,7 +326,7 @@ static const SaveLoad _station_desc[] = {
|
||||||
SLE_VAR(Station, last_vehicle_type, SLE_UINT8),
|
SLE_VAR(Station, last_vehicle_type, SLE_UINT8),
|
||||||
SLE_VAR(Station, had_vehicle_of_type, SLE_UINT8),
|
SLE_VAR(Station, had_vehicle_of_type, SLE_UINT8),
|
||||||
SLE_LST(Station, loading_vehicles, REF_VEHICLE),
|
SLE_LST(Station, loading_vehicles, REF_VEHICLE),
|
||||||
SLE_CONDVAR(Station, town_acc, SLE_UINT32, 127, SL_MAX_VERSION),
|
SLE_CONDVAR(Station, always_accepted, SLE_UINT32, 127, SL_MAX_VERSION),
|
||||||
|
|
||||||
SLE_END()
|
SLE_END()
|
||||||
};
|
};
|
||||||
|
|
|
@ -85,7 +85,7 @@ public:
|
||||||
byte last_vehicle_type;
|
byte last_vehicle_type;
|
||||||
std::list<Vehicle *> loading_vehicles;
|
std::list<Vehicle *> loading_vehicles;
|
||||||
GoodsEntry goods[NUM_CARGO]; ///< Goods at this station
|
GoodsEntry goods[NUM_CARGO]; ///< Goods at this station
|
||||||
uint32 town_acc; ///< Bitmask of cargos accepted by town houses and headquarters
|
uint32 always_accepted; ///< Bitmask of cargos accepted by town houses and headquarters
|
||||||
|
|
||||||
IndustryVector industries_near; ///< Cached list of industries near the station that can accept cargo, @see DeliverGoodsToIndustry()
|
IndustryVector industries_near; ///< Cached list of industries near the station that can accept cargo, @see DeliverGoodsToIndustry()
|
||||||
|
|
||||||
|
|
|
@ -508,12 +508,12 @@ CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad)
|
||||||
* @param w X extent of area
|
* @param w X extent of area
|
||||||
* @param h Y extent of area
|
* @param h Y extent of area
|
||||||
* @param rad Search radius in addition to given area
|
* @param rad Search radius in addition to given area
|
||||||
* @param town_acc bitmask of cargo accepted by houses and headquarters; can be NULL
|
* @param always_accepted bitmask of cargo accepted by houses and headquarters; can be NULL
|
||||||
*/
|
*/
|
||||||
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *town_acc)
|
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *always_accepted)
|
||||||
{
|
{
|
||||||
CargoArray acceptance;
|
CargoArray acceptance;
|
||||||
if (town_acc != NULL) *town_acc = 0;
|
if (always_accepted != NULL) *always_accepted = 0;
|
||||||
|
|
||||||
int x = TileX(tile);
|
int x = TileX(tile);
|
||||||
int y = TileY(tile);
|
int y = TileY(tile);
|
||||||
|
@ -533,7 +533,7 @@ CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint3
|
||||||
for (int yc = y1; yc != y2; yc++) {
|
for (int yc = y1; yc != y2; yc++) {
|
||||||
for (int xc = x1; xc != x2; xc++) {
|
for (int xc = x1; xc != x2; xc++) {
|
||||||
TileIndex tile = TileXY(xc, yc);
|
TileIndex tile = TileXY(xc, yc);
|
||||||
AddAcceptedCargo(tile, acceptance, town_acc);
|
AddAcceptedCargo(tile, acceptance, always_accepted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,7 +557,7 @@ void UpdateStationAcceptance(Station *st, bool show_msg)
|
||||||
st->rect.right - st->rect.left + 1,
|
st->rect.right - st->rect.left + 1,
|
||||||
st->rect.bottom - st->rect.top + 1,
|
st->rect.bottom - st->rect.top + 1,
|
||||||
st->GetCatchmentRadius(),
|
st->GetCatchmentRadius(),
|
||||||
&st->town_acc
|
&st->always_accepted
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void ShowStationViewWindow(StationID station);
|
||||||
void UpdateAllStationVirtCoords();
|
void UpdateAllStationVirtCoords();
|
||||||
|
|
||||||
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad);
|
CargoArray GetProductionAroundTiles(TileIndex tile, int w, int h, int rad);
|
||||||
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *town_acc = NULL);
|
CargoArray GetAcceptanceAroundTiles(TileIndex tile, int w, int h, int rad, uint32 *always_accepted = NULL);
|
||||||
|
|
||||||
void UpdateStationAcceptance(Station *st, bool show_msg);
|
void UpdateStationAcceptance(Station *st, bool show_msg);
|
||||||
|
|
||||||
|
|
|
@ -78,11 +78,11 @@ typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlag flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tile callback function signature for obtaining cargo acceptance of a tile
|
* Tile callback function signature for obtaining cargo acceptance of a tile
|
||||||
* @param tile Tile queried for its accepted cargo
|
* @param tile Tile queried for its accepted cargo
|
||||||
* @param acceptance Storage destination of the cargo acceptance in 1/8
|
* @param acceptance Storage destination of the cargo acceptance in 1/8
|
||||||
* @param town_acc Bitmask of town and headquarters-accepted cargo
|
* @param always_accepted Bitmask of town and headquarters-accepted cargo
|
||||||
*/
|
*/
|
||||||
typedef void AddAcceptedCargoProc(TileIndex tile, CargoArray &acceptance, uint32 *town_acc);
|
typedef void AddAcceptedCargoProc(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tile callback function signature for obtaining a tile description
|
* Tile callback function signature for obtaining a tile description
|
||||||
|
@ -165,12 +165,12 @@ VehicleEnterTileStatus VehicleEnterTile(Vehicle *v, TileIndex tile, int x, int y
|
||||||
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner);
|
void ChangeTileOwner(TileIndex tile, Owner old_owner, Owner new_owner);
|
||||||
void GetTileDesc(TileIndex tile, TileDesc *td);
|
void GetTileDesc(TileIndex tile, TileDesc *td);
|
||||||
|
|
||||||
static inline void AddAcceptedCargo(TileIndex tile, CargoArray &acceptance, uint32 *town_acc)
|
static inline void AddAcceptedCargo(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted)
|
||||||
{
|
{
|
||||||
AddAcceptedCargoProc *proc = _tile_type_procs[GetTileType(tile)]->add_accepted_cargo_proc;
|
AddAcceptedCargoProc *proc = _tile_type_procs[GetTileType(tile)]->add_accepted_cargo_proc;
|
||||||
if (proc == NULL) return;
|
if (proc == NULL) return;
|
||||||
uint32 dummy = 0; // use dummy bitmask so there don't need to be several 'town_acc != NULL' checks
|
uint32 dummy = 0; // use dummy bitmask so there don't need to be several 'always_accepted != NULL' checks
|
||||||
proc(tile, acceptance, town_acc == NULL ? &dummy : town_acc);
|
proc(tile, acceptance, always_accepted == NULL ? &dummy : always_accepted);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void AddProducedCargo(TileIndex tile, CargoArray &produced)
|
static inline void AddProducedCargo(TileIndex tile, CargoArray &produced)
|
||||||
|
|
|
@ -592,14 +592,14 @@ static void AddProducedCargo_Town(TileIndex tile, CargoArray &produced)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void AddAcceptedCargoSetMask(CargoID cargo, uint amount, CargoArray &acceptance, uint32 *town_acc)
|
static inline void AddAcceptedCargoSetMask(CargoID cargo, uint amount, CargoArray &acceptance, uint32 *always_accepted)
|
||||||
{
|
{
|
||||||
if (cargo == CT_INVALID || amount == 0) return;
|
if (cargo == CT_INVALID || amount == 0) return;
|
||||||
acceptance[cargo] += amount;
|
acceptance[cargo] += amount;
|
||||||
SetBit(*town_acc, cargo);
|
SetBit(*always_accepted, cargo);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddAcceptedCargo_Town(TileIndex tile, CargoArray &acceptance, uint32 *town_acc)
|
static void AddAcceptedCargo_Town(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted)
|
||||||
{
|
{
|
||||||
const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile));
|
const HouseSpec *hs = HouseSpec::Get(GetHouseType(tile));
|
||||||
CargoID accepts[3];
|
CargoID accepts[3];
|
||||||
|
@ -624,13 +624,13 @@ static void AddAcceptedCargo_Town(TileIndex tile, CargoArray &acceptance, uint32
|
||||||
if (HasBit(hs->callback_mask, CBM_HOUSE_CARGO_ACCEPTANCE)) {
|
if (HasBit(hs->callback_mask, CBM_HOUSE_CARGO_ACCEPTANCE)) {
|
||||||
uint16 callback = GetHouseCallback(CBID_HOUSE_CARGO_ACCEPTANCE, 0, 0, GetHouseType(tile), Town::GetByTile(tile), tile);
|
uint16 callback = GetHouseCallback(CBID_HOUSE_CARGO_ACCEPTANCE, 0, 0, GetHouseType(tile), Town::GetByTile(tile), tile);
|
||||||
if (callback != CALLBACK_FAILED) {
|
if (callback != CALLBACK_FAILED) {
|
||||||
AddAcceptedCargoSetMask(accepts[0], GB(callback, 0, 4), acceptance, town_acc);
|
AddAcceptedCargoSetMask(accepts[0], GB(callback, 0, 4), acceptance, always_accepted);
|
||||||
AddAcceptedCargoSetMask(accepts[1], GB(callback, 4, 4), acceptance, town_acc);
|
AddAcceptedCargoSetMask(accepts[1], GB(callback, 4, 4), acceptance, always_accepted);
|
||||||
if (_settings_game.game_creation.landscape != LT_TEMPERATE && HasBit(callback, 12)) {
|
if (_settings_game.game_creation.landscape != LT_TEMPERATE && HasBit(callback, 12)) {
|
||||||
/* The 'S' bit indicates food instead of goods */
|
/* The 'S' bit indicates food instead of goods */
|
||||||
AddAcceptedCargoSetMask(CT_FOOD, GB(callback, 8, 4), acceptance, town_acc);
|
AddAcceptedCargoSetMask(CT_FOOD, GB(callback, 8, 4), acceptance, always_accepted);
|
||||||
} else {
|
} else {
|
||||||
AddAcceptedCargoSetMask(accepts[2], GB(callback, 8, 4), acceptance, town_acc);
|
AddAcceptedCargoSetMask(accepts[2], GB(callback, 8, 4), acceptance, always_accepted);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -638,7 +638,7 @@ static void AddAcceptedCargo_Town(TileIndex tile, CargoArray &acceptance, uint32
|
||||||
|
|
||||||
/* No custom acceptance, so fill in with the default values */
|
/* No custom acceptance, so fill in with the default values */
|
||||||
for (uint8 i = 0; i < lengthof(accepts); i++) {
|
for (uint8 i = 0; i < lengthof(accepts); i++) {
|
||||||
AddAcceptedCargoSetMask(accepts[i], hs->cargo_acceptance[i], acceptance, town_acc);
|
AddAcceptedCargoSetMask(accepts[i], hs->cargo_acceptance[i], acceptance, always_accepted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ static CommandCost ClearTile_Unmovable(TileIndex tile, DoCommandFlag flags)
|
||||||
return CommandCost();
|
return CommandCost();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void AddAcceptedCargo_Unmovable(TileIndex tile, CargoArray &acceptance, uint32 *town_acc)
|
static void AddAcceptedCargo_Unmovable(TileIndex tile, CargoArray &acceptance, uint32 *always_accepted)
|
||||||
{
|
{
|
||||||
if (!IsCompanyHQ(tile)) return;
|
if (!IsCompanyHQ(tile)) return;
|
||||||
|
|
||||||
|
@ -318,14 +318,14 @@ static void AddAcceptedCargo_Unmovable(TileIndex tile, CargoArray &acceptance, u
|
||||||
/* Top town building generates 10, so to make HQ interesting, the top
|
/* Top town building generates 10, so to make HQ interesting, the top
|
||||||
* type makes 20. */
|
* type makes 20. */
|
||||||
acceptance[CT_PASSENGERS] += max(1U, level);
|
acceptance[CT_PASSENGERS] += max(1U, level);
|
||||||
SetBit(*town_acc, CT_PASSENGERS);
|
SetBit(*always_accepted, CT_PASSENGERS);
|
||||||
|
|
||||||
/* Top town building generates 4, HQ can make up to 8. The
|
/* Top town building generates 4, HQ can make up to 8. The
|
||||||
* proportion passengers:mail is different because such a huge
|
* proportion passengers:mail is different because such a huge
|
||||||
* commercial building generates unusually high amount of mail
|
* commercial building generates unusually high amount of mail
|
||||||
* correspondence per physical visitor. */
|
* correspondence per physical visitor. */
|
||||||
acceptance[CT_MAIL] += max(1U, level / 2);
|
acceptance[CT_MAIL] += max(1U, level / 2);
|
||||||
SetBit(*town_acc, CT_MAIL);
|
SetBit(*always_accepted, CT_MAIL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue