summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-21 13:45:03 +0000
committerrubidium <rubidium@openttd.org>2008-04-21 13:45:03 +0000
commitbbe13a0623eea9f46353fca57a35ae745040fbaf (patch)
treec45ca2198e745f3be4cfbe13a2949d2699a4b1f3
parent5a17e6b395beb773c992b2195f80d25d3bfc9759 (diff)
downloadopenttd-bbe13a0623eea9f46353fca57a35ae745040fbaf.tar.xz
(svn r12818) -Codechange: make callbacks 31 and 37 behave like they do in TTDP according to frosch's survey.
-rw-r--r--src/aircraft_cmd.cpp2
-rw-r--r--src/industry_gui.cpp4
-rw-r--r--src/roadveh_cmd.cpp9
-rw-r--r--src/ship_cmd.cpp9
-rw-r--r--src/train_cmd.cpp2
5 files changed, 10 insertions, 16 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index e1ebdba0f..a2da629ac 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -530,7 +530,7 @@ CommandCost CmdStartStopAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32
/* Check if this aircraft can be started/stopped. The callback will fail or
* return 0xFF if it can. */
uint16 callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v);
- if (callback != CALLBACK_FAILED && callback != 0xFF) {
+ if (callback != CALLBACK_FAILED && GB(callback, 0, 8) != 0xFF) {
StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback);
return_cmd_error(error);
}
diff --git a/src/industry_gui.cpp b/src/industry_gui.cpp
index 958ab5a97..9df7ac4b5 100644
--- a/src/industry_gui.cpp
+++ b/src/industry_gui.cpp
@@ -78,8 +78,8 @@ static StringID GetCargoSuffix(uint cargo, Industry *ind, IndustryType ind_type,
{
if (HasBit(indspec->callback_flags, CBM_IND_CARGO_SUFFIX)) {
bool fund = ind == NULL;
- uint8 callback = GetIndustryCallback(CBID_INDUSTRY_CARGO_SUFFIX, 0, ((!fund) ? 1 << 8 : 0) | cargo, ind, ind_type, (!fund) ? ind->xy : INVALID_TILE);
- if (callback != 0xFF) return GetGRFStringID(indspec->grf_prop.grffile->grfid, 0xD000 + callback);
+ uint16 callback = GetIndustryCallback(CBID_INDUSTRY_CARGO_SUFFIX, 0, ((!fund) ? 1 << 8 : 0) | cargo, ind, ind_type, (!fund) ? ind->xy : INVALID_TILE);
+ if (GB(callback, 0, 8) != 0xFF) return GetGRFStringID(indspec->grf_prop.grffile->grfid, 0xD000 + callback);
}
return STR_EMPTY;
}
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 30f5af2ec..19578162f 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -293,19 +293,16 @@ CommandCost CmdBuildRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
*/
CommandCost CmdStartStopRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Vehicle *v;
- uint16 callback;
-
if (!IsValidVehicleID(p1)) return CMD_ERROR;
- v = GetVehicle(p1);
+ Vehicle *v = GetVehicle(p1);
if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
/* Check if this road veh can be started/stopped. The callback will fail or
* return 0xFF if it can. */
- callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v);
- if (callback != CALLBACK_FAILED && callback != 0xFF) {
+ uint16 callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v);
+ if (callback != CALLBACK_FAILED && GB(callback, 0, 8) != 0xFF) {
StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback);
return_cmd_error(error);
}
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 1207d2a68..2a0e7222b 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -882,19 +882,16 @@ CommandCost CmdSellShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
*/
CommandCost CmdStartStopShip(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Vehicle *v;
- uint16 callback;
-
if (!IsValidVehicleID(p1)) return CMD_ERROR;
- v = GetVehicle(p1);
+ Vehicle *v = GetVehicle(p1);
if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
/* Check if this ship can be started/stopped. The callback will fail or
* return 0xFF if it can. */
- callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v);
- if (callback != CALLBACK_FAILED && callback != 0xFF) {
+ uint16 callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v);
+ if (callback != CALLBACK_FAILED && GB(callback, 0, 8) != 0xFF) {
StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback);
return_cmd_error(error);
}
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 98461d45d..4f55e30ce 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -1280,7 +1280,7 @@ CommandCost CmdStartStopTrain(TileIndex tile, uint32 flags, uint32 p1, uint32 p2
/* Check if this train can be started/stopped. The callback will fail or
* return 0xFF if it can. */
uint16 callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v);
- if (callback != CALLBACK_FAILED && callback != 0xFF) {
+ if (callback != CALLBACK_FAILED && GB(callback, 0, 8) != 0xFF) {
StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback);
return_cmd_error(error);
}