summaryrefslogtreecommitdiff
path: root/src/openttd.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-01-31 22:33:24 +0000
committermaedhros <maedhros@openttd.org>2007-01-31 22:33:24 +0000
commitd8edc2bb98d3e15c53a4174e91e6882b1f835235 (patch)
treeb3824aeb166a5bf6f38d69ce8bec3354349343e6 /src/openttd.cpp
parent43242302e01894c5aa5b6488537fcff75aa6a36d (diff)
downloadopenttd-d8edc2bb98d3e15c53a4174e91e6882b1f835235.tar.xz
(svn r8501) -Fix (r7377) [FS#539]: Keep track of how much cargo has been paid for, so that cargo cannot be paid for more than once.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r--src/openttd.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp
index 9377483e1..1d71d042b 100644
--- a/src/openttd.cpp
+++ b/src/openttd.cpp
@@ -1748,6 +1748,23 @@ bool AfterLoadGame(void)
}
}
+ if (CheckSavegameVersion(45)) {
+ Vehicle *v;
+ /* Originally just the fact that some cargo had been paid for was
+ * stored to stop people cheating and cashing in several times. This
+ * wasn't enough though as it was cleared when the vehicle started
+ * loading again, even if it didn't actually load anything, so now the
+ * amount of cargo that has been paid for is stored. */
+ FOR_ALL_VEHICLES(v) {
+ if (HASBIT(v->load_status, 2)) {
+ v->cargo_paid_for = v->cargo_count;
+ CLRBIT(v->load_status, 2);
+ } else {
+ v->cargo_paid_for = 0;
+ }
+ }
+ }
+
return true;
}