summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-05-02 18:29:11 +0000
committerrubidium <rubidium@openttd.org>2007-05-02 18:29:11 +0000
commit981bf52bdd1a2f5fbf447f211a4dbbb43547aee3 (patch)
tree34ee55f1443a9aa3ff65e7d58e973121dd9ce61f /src/vehicle.cpp
parente4dc1f460b4e431bf3336a5fde25ab0dbe580e5e (diff)
downloadopenttd-981bf52bdd1a2f5fbf447f211a4dbbb43547aee3.tar.xz
(svn r9770) -Codechange: perform the payment of cargo when loading/unloading, but when arriving at the station.
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 20f67c771..8920c4376 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -40,6 +40,7 @@
#include "newgrf_engine.h"
#include "newgrf_sound.h"
#include "helpers.hpp"
+#include "economy.h"
#define INVALID_COORD (-0x8000)
#define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6))
@@ -741,6 +742,7 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v)
return keep_loading || (not_full && (full & ~not_full) == 0);
}
+
bool CanFillVehicle(Vehicle *v)
{
TileIndex tile = v->tile;
@@ -2971,11 +2973,15 @@ void Vehicle::BeginLoading()
GetStation(this->last_station_visited)->loading_vehicles.push_back(this);
SET_EXPENSES_TYPE(this->GetExpenseType(true));
- if (LoadUnloadVehicle(this, true) != 0) {
- InvalidateWindow(this->GetVehicleListWindowClass(), this->owner);
- this->MarkDirty();
- }
+ VehiclePayment(this);
+
+ InvalidateWindow(this->GetVehicleListWindowClass(), this->owner);
InvalidateWindowWidget(WC_VEHICLE_VIEW, this->index, STATUS_BAR);
+ InvalidateWindow(WC_VEHICLE_DETAILS, this->index);
+ InvalidateWindow(WC_STATION_VIEW, this->last_station_visited);
+
+ GetStation(this->last_station_visited)->MarkTilesDirty();
+ this->MarkDirty();
}
void Vehicle::LeaveStation()