mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r5819) - NewGRF: add support for refit costs specified in NewGRF. This may affect the default refit costs for the default rail vehicles.
This commit is contained in:
parent
83290e8cea
commit
53d2650d9b
@ -594,7 +594,7 @@ int32 CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
|
|
||||||
cost = 0;
|
cost = 0;
|
||||||
if (IS_HUMAN_PLAYER(v->owner) && new_cid != v->cargo_type) {
|
if (IS_HUMAN_PLAYER(v->owner) && new_cid != v->cargo_type) {
|
||||||
cost = _price.aircraft_base >> 7;
|
cost = (EngInfo(v->engine_type)->refit_cost * _price.aircraft_base) >> 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
@ -1798,7 +1798,7 @@ int32 CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
|
|
||||||
cost = 0;
|
cost = 0;
|
||||||
if (IS_HUMAN_PLAYER(v->owner) && new_cid != v->cargo_type) {
|
if (IS_HUMAN_PLAYER(v->owner) && new_cid != v->cargo_type) {
|
||||||
cost = _price.roadveh_base >> 7;
|
cost = (EngInfo(v->engine_type)->refit_cost * _price.roadveh_base) >> 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
@ -1081,7 +1081,7 @@ int32 CmdRefitShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
|
|
||||||
cost = 0;
|
cost = 0;
|
||||||
if (IS_HUMAN_PLAYER(v->owner) && new_cid != v->cargo_type) {
|
if (IS_HUMAN_PLAYER(v->owner) && new_cid != v->cargo_type) {
|
||||||
cost = _price.ship_base >> 7;
|
cost = (EngInfo(v->engine_type)->refit_cost * _price.ship_base) >> 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* @param e Rail Type of the vehicle
|
* @param e Rail Type of the vehicle
|
||||||
* @param f Bitmask of the climates
|
* @param f Bitmask of the climates
|
||||||
*/
|
*/
|
||||||
#define MK(a, b, c, d, e, f) { a, b, c, d, e, f, 0, 0, 0, 0 }
|
#define MK(a, b, c, d, e, f) { a, b, c, d, e, f, 0, 8, 0, 0 }
|
||||||
/** Writes the properties of a train carriage into the EngineInfo struct.
|
/** Writes the properties of a train carriage into the EngineInfo struct.
|
||||||
* @see EngineInfo
|
* @see EngineInfo
|
||||||
* @param a Introduction date
|
* @param a Introduction date
|
||||||
@ -23,7 +23,7 @@
|
|||||||
* @param f Bitmask of the climates
|
* @param f Bitmask of the climates
|
||||||
* @note the 0x80 in parameter b sets the "is carriage bit"
|
* @note the 0x80 in parameter b sets the "is carriage bit"
|
||||||
*/
|
*/
|
||||||
#define MW(a, b, c, d, e, f) { a, b | 0x80, c, d, e, f, 0, 0, 0, 0 }
|
#define MW(a, b, c, d, e, f) { a, b | 0x80, c, d, e, f, 0, 8, 0, 0 }
|
||||||
|
|
||||||
// Rail types
|
// Rail types
|
||||||
// R = Conventional railway
|
// R = Conventional railway
|
||||||
|
@ -1794,7 +1794,12 @@ int32 CmdRefitRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (amount != 0) {
|
if (amount != 0) {
|
||||||
if (new_cid != v->cargo_type) cost += _price.build_railvehicle >> 8;
|
if (new_cid != v->cargo_type) {
|
||||||
|
int32 base_cost = (rvi->flags & RVI_WAGON) ?
|
||||||
|
_price.build_railwagon : _price.build_railvehicle;
|
||||||
|
cost += (EngInfo(v->engine_type)->refit_cost * base_cost) >> 9;
|
||||||
|
}
|
||||||
|
|
||||||
num += amount;
|
num += amount;
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
v->cargo_count = (v->cargo_type == new_cid) ? min(amount, v->cargo_count) : 0;
|
v->cargo_count = (v->cargo_type == new_cid) ? min(amount, v->cargo_count) : 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user