diff options
author | peter1138 <peter1138@openttd.org> | 2008-04-29 21:31:29 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2008-04-29 21:31:29 +0000 |
commit | 45034bc522c8e541b5ec8b38868d13cc6290e3ac (patch) | |
tree | 82b8c0d69acb1c38843e4fcf0b11f46a057ef270 /src/openttd.cpp | |
parent | 6056d1fb3178e06bf6ce1098e918fe13edb56f18 (diff) | |
download | openttd-45034bc522c8e541b5ec8b38868d13cc6290e3ac.tar.xz |
(svn r12924) -Feature: Introducing the so called 'engine pool' which primarily removes the fixed engine type limits and also happens to allow (with the patch option 'dynamic_engines') multiple NewGRF vehicle sets to coexist.
Diffstat (limited to 'src/openttd.cpp')
-rw-r--r-- | src/openttd.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/openttd.cpp b/src/openttd.cpp index 402d6276b..be999af16 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -305,6 +305,7 @@ static void UnInitializeGame() _Order_pool.CleanPool(); _Group_pool.CleanPool(); _CargoPacket_pool.CleanPool(); + _Engine_pool.CleanPool(); free((void*)_town_sort); free((void*)_industry_sort); @@ -1332,6 +1333,8 @@ static bool InitializeWindowsAndCaches() /* Recalculate */ Group *g; FOR_ALL_GROUPS(g) { + g->num_engines = CallocT<uint16>(GetEnginePoolSize()); + const Vehicle *v; FOR_ALL_VEHICLES(v) { if (!IsEngineCountable(v)) continue; @@ -1354,6 +1357,9 @@ static bool InitializeWindowsAndCaches() * thus the MIN_YEAR (which is really nothing more than Zero, initialized value) test */ if (_file_to_saveload.filetype == FT_SCENARIO && players[i]->inaugurated_year != MIN_YEAR) players[i]->inaugurated_year = _cur_year; + + free(players[i]->num_engines); + players[i]->num_engines = CallocT<uint16>(GetEnginePoolSize()); } FOR_ALL_VEHICLES(v) { @@ -1444,10 +1450,16 @@ bool AfterLoadGame() * must be done before loading sprites as some newgrfs check it */ SetDate(_date); + /* Force dynamic engines off when loading older savegames */ + if (CheckSavegameVersion(95)) _patches.dynamic_engines = 0; + /* Load the sprites */ GfxLoadSprites(); LoadStringWidthTable(); + /* Copy temporary data to Engine pool */ + CopyTempEngineData(); + /* Connect front and rear engines of multiheaded trains and converts * subtype to the new format */ if (CheckSavegameVersionOldStyle(17, 1)) ConvertOldMultiheadToNew(); |