diff options
author | fonsinchen <fonsinchen@openttd.org> | 2013-06-09 14:10:33 +0000 |
---|---|---|
committer | fonsinchen <fonsinchen@openttd.org> | 2013-06-09 14:10:33 +0000 |
commit | 6166772bc57054440a107140577ef372a8d97b9b (patch) | |
tree | 5e9667c2108fe0959122e6452fd0c146a8d5bd31 | |
parent | 9a92d55dee4834f45989791118ca5d6b8598aef5 (diff) | |
download | openttd-6166772bc57054440a107140577ef372a8d97b9b.tar.xz |
(svn r25379) -Fix: avoid warning in FlowStatMap::FinalizeLocalConsumption
-rw-r--r-- | src/station_cmd.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 502ba15e5..ae2ba9588 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -4173,8 +4173,13 @@ void FlowStatMap::FinalizeLocalConsumption(StationID self) for (FlowStatMap::iterator i = this->begin(); i != this->end(); ++i) { FlowStat &fs = i->second; uint local = fs.GetShare(INVALID_STATION); - fs.ChangeShare(self, -local); - fs.ChangeShare(INVALID_STATION, -local); + if (local > INT_MAX) { // make sure it fits in an int + fs.ChangeShare(self, -INT_MAX); + fs.ChangeShare(INVALID_STATION, -INT_MAX); + local -= INT_MAX; + } + fs.ChangeShare(self, (int)-local); + fs.ChangeShare(INVALID_STATION, (int)-local); /* If the local share is used up there must be a share for some * remote station. */ |