# HG changeset patch # User tron # Date 1172399125 0 # Node ID 817c29f1882b738dca239418c0b3a71712667acf # Parent c0add302a0094ce69efd0650be981e97507e749f (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. diff -r c0add302a009 -r 817c29f1882b src/ship_cmd.cpp --- a/src/ship_cmd.cpp Sun Feb 25 09:47:46 2007 +0000 +++ b/src/ship_cmd.cpp Sun Feb 25 10:25:25 2007 +0000 @@ -692,7 +692,8 @@ 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 -r c0add302a009 -r 817c29f1882b src/train_cmd.cpp --- a/src/train_cmd.cpp Sun Feb 25 09:47:46 2007 +0000 +++ b/src/train_cmd.cpp Sun Feb 25 10:25:25 2007 +0000 @@ -2887,9 +2887,10 @@ 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 @@ } } 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 -r c0add302a009 -r 817c29f1882b src/vehicle.cpp --- a/src/vehicle.cpp Sun Feb 25 09:47:46 2007 +0000 +++ b/src/vehicle.cpp Sun Feb 25 10:25:25 2007 +0000 @@ -2692,7 +2692,7 @@ } /* 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 @@ 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 -r c0add302a009 -r 817c29f1882b src/vehicle.h --- a/src/vehicle.h Sun Feb 25 09:47:46 2007 +0000 +++ b/src/vehicle.h Sun Feb 25 10:25:25 2007 +0000 @@ -427,7 +427,7 @@ 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 {