Import infrastructure sharing patch

Strip trailing whitespace
Remove a leftover line form settings.ini

http://www.tt-forums.net/viewtopic.php?p=1008843#p1008843
This commit is contained in:
patch-import
2015-08-06 22:24:24 +01:00
committed by Jonathan G Rennison
parent 856896c36e
commit ee791055f9
32 changed files with 794 additions and 66 deletions

View File

@@ -49,6 +49,7 @@
#include "../engine_func.h"
#include "../rail_gui.h"
#include "../core/backup_type.hpp"
#include "../core/mem_func.hpp"
#include "../smallmap_gui.h"
#include "../news_func.h"
#include "../error.h"
@@ -2296,6 +2297,20 @@ bool AfterLoadGame()
FOR_ALL_DEPOTS(d) d->build_date = _date;
}
if (IsSavegameVersionBefore(200)) {
Company *c;
FOR_ALL_COMPANIES(c) {
/* yearly_expenses has 3*15 entries now, saveload code gave us 3*13.
* Move the old data to the right place in the new array and clear the new data.
* The move has to be done in reverse order (first 2, then 1). */
MemMoveT(&c->yearly_expenses[2][0], &c->yearly_expenses[1][11], 13);
MemMoveT(&c->yearly_expenses[1][0], &c->yearly_expenses[0][13], 13);
/* Clear the old location of just-moved data, so sharing income/expenses is set to 0 */
MemSetT(&c->yearly_expenses[0][13], 0, 2);
MemSetT(&c->yearly_expenses[1][13], 0, 2);
}
}
/* In old versions it was possible to remove an airport while a plane was
* taking off or landing. This gives all kind of problems when building
* another airport in the same station so we don't allow that anymore.

View File

@@ -281,7 +281,8 @@ static const SaveLoad _company_desc[] = {
/* yearly expenses was changed to 64-bit in savegame version 2. */
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_FILE_I32 | SLE_VAR_I64, 3 * 13, 0, 1),
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 13, 2, SL_MAX_VERSION),
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 13, 2, 200),
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 15, 200, SL_MAX_VERSION),
SLE_CONDVAR(CompanyProperties, is_ai, SLE_BOOL, 2, SL_MAX_VERSION),
SLE_CONDNULL(1, 107, 111), ///< is_noai

View File

@@ -239,7 +239,7 @@
* 173 23967 1.2.0-RC1
* 174 23973 1.2.x
*/
extern const uint16 SAVEGAME_VERSION = 174; ///< Current savegame version of OpenTTD.
extern const uint16 SAVEGAME_VERSION = 200; ///< Current savegame version of OpenTTD.
SavegameType _savegame_type; ///< type of savegame we are loading