summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorfonsinchen <fonsinchen@openttd.org>2013-10-22 16:13:54 +0000
committerfonsinchen <fonsinchen@openttd.org>2013-10-22 16:13:54 +0000
commit6524849386fa7b24814db93746c2c07c3de8f1c0 (patch)
tree8fd05e9a727286abff1f36c1d69c4411e0c4052a /src/saveload
parent29e987f3fc13dc1e2a90f07556bf033b81a13e36 (diff)
downloadopenttd-6524849386fa7b24814db93746c2c07c3de8f1c0.tar.xz
(svn r25899) -Change: Restrict flows if links are restricted and don't normally pick them anymore.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/saveload.cpp3
-rw-r--r--src/saveload/station_sl.cpp13
2 files changed, 10 insertions, 6 deletions
diff --git a/src/saveload/saveload.cpp b/src/saveload/saveload.cpp
index a4ad9059b..88f812097 100644
--- a/src/saveload/saveload.cpp
+++ b/src/saveload/saveload.cpp
@@ -252,8 +252,9 @@
* 184 25508
* 185 25620
* 186 25833
+ * 187 ?????
*/
-extern const uint16 SAVEGAME_VERSION = 186; ///< Current savegame version of OpenTTD.
+extern const uint16 SAVEGAME_VERSION = 187; ///< Current savegame version of OpenTTD.
SavegameType _savegame_type; ///< type of savegame we are loading
diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp
index 8193bf623..d01c0f3c6 100644
--- a/src/saveload/station_sl.cpp
+++ b/src/saveload/station_sl.cpp
@@ -245,13 +245,15 @@ struct FlowSaveLoad {
StationID source;
StationID via;
uint32 share;
+ bool restricted;
};
static const SaveLoad _flow_desc[] = {
- SLE_VAR(FlowSaveLoad, source, SLE_UINT16),
- SLE_VAR(FlowSaveLoad, via, SLE_UINT16),
- SLE_VAR(FlowSaveLoad, share, SLE_UINT32),
- SLE_END()
+ SLE_VAR(FlowSaveLoad, source, SLE_UINT16),
+ SLE_VAR(FlowSaveLoad, via, SLE_UINT16),
+ SLE_VAR(FlowSaveLoad, share, SLE_UINT32),
+ SLE_CONDVAR(FlowSaveLoad, restricted, SLE_BOOL, 187, SL_MAX_VERSION),
+ SLE_END()
};
/**
@@ -481,6 +483,7 @@ static void RealSave_STNN(BaseStation *bst)
for (FlowStat::SharesMap::const_iterator inner_it(shares->begin()); inner_it != shares->end(); ++inner_it) {
flow.via = inner_it->second;
flow.share = inner_it->first - sum_shares;
+ flow.restricted = inner_it->first > outer_it->second.GetUnrestricted();
sum_shares = inner_it->first;
assert(flow.share > 0);
SlObject(&flow, _flow_desc);
@@ -538,7 +541,7 @@ static void Load_STNN()
if (fs == NULL || prev_source != flow.source) {
fs = &(st->goods[i].flows.insert(std::make_pair(flow.source, FlowStat(flow.via, flow.share))).first->second);
} else {
- fs->AppendShare(flow.via, flow.share);
+ fs->AppendShare(flow.via, flow.share, flow.restricted);
}
prev_source = flow.source;
}