(svn r25899) -Change: Restrict flows if links are restricted and don't normally pick them anymore.
This commit is contained in:
@@ -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
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user