summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2007-02-25 10:25:25 +0000
committertron <tron@openttd.org>2007-02-25 10:25:25 +0000
commit270e366772236f06c448cb170575422131316b16 (patch)
treeabc5191717ba01b74c3935c96421507302feb34d
parent5d081ed3509fdcbac388985061bdd9f537a955a0 (diff)
downloadopenttd-270e366772236f06c448cb170575422131316b16.tar.xz
(svn r8896) -Fix
Most (i.e. 13 of 15) callers of GetNewVehiclePos() do not care for the return and the others can figure it out by inspecting the information returned in struct GetNewVehiclePosResult. Therefore remove the return value.
-rw-r--r--src/ship_cmd.cpp3
-rw-r--r--src/train_cmd.cpp5
-rw-r--r--src/vehicle.cpp3
-rw-r--r--src/vehicle.h2
4 files changed, 6 insertions, 7 deletions
diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp
index 74f5554d1..f2b11ea76 100644
--- a/src/ship_cmd.cpp
+++ b/src/ship_cmd.cpp
@@ -692,7 +692,8 @@ static void ShipController(Vehicle *v)
BeginVehicleMove(v);
- if (GetNewVehiclePos(v, &gp)) {
+ GetNewVehiclePos(v, &gp);
+ if (gp.old_tile == gp.new_tile) {
/* Staying in tile */
if (IsShipInDepot(v)) {
gp.x = v->x_pos;
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 9a0e8c702..a952f732a 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2887,9 +2887,10 @@ static void TrainController(Vehicle *v, bool update_image)
BeginVehicleMove(v);
GetNewVehiclePosResult gp;
+ GetNewVehiclePos(v, &gp);
if (v->u.rail.track != TRACK_BIT_WORMHOLE) {
/* Not inside tunnel */
- if (GetNewVehiclePos(v, &gp)) {
+ if (gp.old_tile == gp.new_tile) {
/* Staying in the old tile */
if (v->u.rail.track == TRACK_BIT_DEPOT) {
/* Inside depot */
@@ -3039,8 +3040,6 @@ static void TrainController(Vehicle *v, bool update_image)
}
} else {
/* In tunnel or on a bridge */
- GetNewVehiclePos(v, &gp);
-
if (!(v->vehstatus & VS_HIDDEN)) {
v->cur_speed =
min(v->cur_speed, GetBridge(GetBridgeType(v->tile))->speed);
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index c2846ba54..9b05e3b0b 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -2692,7 +2692,7 @@ void EndVehicleMove(Vehicle *v)
}
/* returns true if staying in the same tile */
-bool GetNewVehiclePos(const Vehicle *v, GetNewVehiclePosResult *gp)
+void GetNewVehiclePos(const Vehicle *v, GetNewVehiclePosResult *gp)
{
static const int8 _delta_coord[16] = {
-1,-1,-1, 0, 1, 1, 1, 0, /* x */
@@ -2706,7 +2706,6 @@ bool GetNewVehiclePos(const Vehicle *v, GetNewVehiclePosResult *gp)
gp->y = y;
gp->old_tile = v->tile;
gp->new_tile = TileVirtXY(x, y);
- return gp->old_tile == gp->new_tile;
}
static const Direction _new_direction_table[] = {
diff --git a/src/vehicle.h b/src/vehicle.h
index 93cb13117..8ac880e96 100644
--- a/src/vehicle.h
+++ b/src/vehicle.h
@@ -427,7 +427,7 @@ typedef struct GetNewVehiclePosResult {
Trackdir GetVehicleTrackdir(const Vehicle* v);
/* returns true if staying in the same tile */
-bool GetNewVehiclePos(const Vehicle *v, GetNewVehiclePosResult *gp);
+void GetNewVehiclePos(const Vehicle *v, GetNewVehiclePosResult *gp);
Direction GetDirectionTowards(const Vehicle* v, int x, int y);
#define BEGIN_ENUM_WAGONS(v) do {