author | smatz |
Tue, 03 Jun 2008 18:35:58 +0000 | |
changeset 9457 | 75f11a6caef8 |
parent 9413 | 7042a8ec3fa8 |
child 9659 | 187142ff9b6c |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
9087
diff
changeset
|
3 |
/** @file misc.cpp Misc functions that shouldn't be here. */ |
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6091
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1881
diff
changeset
|
6 |
#include "openttd.h" |
2308 | 7 |
#include "currency.h" |
6453
226bcddeba32
(svn r9609) -Codechange: Move some function prototypes out of functions.h and into landscape.h, and add a few where they didn't exist.
maedhros
parents:
6350
diff
changeset
|
8 |
#include "landscape.h" |
8763
81fadd257f67
(svn r12459) -Codechange: split news.h into news_type.h and news_func.h.
rubidium
parents:
8434
diff
changeset
|
9 |
#include "news_func.h" |
0 | 10 |
#include "saveload.h" |
1752
d65cd19f7117
(svn r2256) - Fix: Trains cannot find a depot when they are in a tunnel. (glx)
matthijs
parents:
1595
diff
changeset
|
11 |
#include "vehicle_gui.h" |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2112
diff
changeset
|
12 |
#include "variables.h" |
8965
29a591456a2f
(svn r12757) -Codechange: move all cheat related stuff from all over the place to a single location.
rubidium
parents:
8925
diff
changeset
|
13 |
#include "cheat_func.h" |
2706
fc872b9b17a7
(svn r3250) -Fix: AIs weren't uninitialized when a new game was loaded
truelight
parents:
2685
diff
changeset
|
14 |
#include "ai/ai.h" |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
15 |
#include "newgrf_house.h" |
6091
c8827d9ae04a
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
5971
diff
changeset
|
16 |
#include "cargotype.h" |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6491
diff
changeset
|
17 |
#include "group.h" |
8224
c5a64d87cc54
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8221
diff
changeset
|
18 |
#include "viewport_func.h" |
8119
52b48108425a
(svn r11680) -Codechange: refactor more out of openttd.h and functions.h.
rubidium
parents:
7971
diff
changeset
|
19 |
#include "economy_func.h" |
8123
ce31d2843a95
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
8119
diff
changeset
|
20 |
#include "zoom_func.h" |
8131
160939e24ed3
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8123
diff
changeset
|
21 |
#include "functions.h" |
8139
4e91c448c409
(svn r11701) -Codechange: removal unnecessary inclusions of map.h (and split map.h).
rubidium
parents:
8131
diff
changeset
|
22 |
#include "map_func.h" |
8140
0d0d8c94f84b
(svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents:
8139
diff
changeset
|
23 |
#include "date_func.h" |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8140
diff
changeset
|
24 |
#include "vehicle_func.h" |
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8140
diff
changeset
|
25 |
#include "texteff.hpp" |
8224
c5a64d87cc54
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8221
diff
changeset
|
26 |
#include "gfx_func.h" |
8925
e0d37ce1eba8
(svn r12695) -Codechange: only allocate window structs when needed. Based on a patch by Alberth.
rubidium
parents:
8819
diff
changeset
|
27 |
#include "core/alloc_type.hpp" |
9457
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9413
diff
changeset
|
28 |
#include "gamelog.h" |
9005
d6b0e0a54ef2
(svn r12800) -Codechange: move the animated tile related functions out of texteff.cpp (it isn't a text effect after all). Also remove a few more functions from functions.
rubidium
parents:
8987
diff
changeset
|
29 |
#include "animated_tile_func.h" |
9127
14f21c5954ee
(svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents:
9111
diff
changeset
|
30 |
#include "tilehighlight_func.h" |
9280
8adb36dcebab
(svn r13146) -Codechange: vehicle_base.h doesn't need to be included in vehicle_gui.h.
rubidium
parents:
9174
diff
changeset
|
31 |
#include "core/bitmath_func.hpp" |
8224
c5a64d87cc54
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8221
diff
changeset
|
32 |
|
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8258
diff
changeset
|
33 |
#include "table/strings.h" |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8258
diff
changeset
|
34 |
#include "table/sprites.h" |
0 | 35 |
|
8973
749e572f9378
(svn r12765) -Codechange: move some stuff out of variables.h that required including other headers in variables.h.
rubidium
parents:
8965
diff
changeset
|
36 |
extern TileIndex _cur_tileloop_tile; |
0 | 37 |
|
6247 | 38 |
void InitializeVehicles(); |
39 |
void InitializeWaypoints(); |
|
40 |
void InitializeDepots(); |
|
41 |
void InitializeEngines(); |
|
42 |
void InitializeOrders(); |
|
43 |
void InitializeClearLand(); |
|
44 |
void InitializeRailGui(); |
|
45 |
void InitializeRoadGui(); |
|
46 |
void InitializeAirportGui(); |
|
47 |
void InitializeDockGui(); |
|
48 |
void InitializeIndustries(); |
|
49 |
void InitializeTowns(); |
|
50 |
void InitializeTrees(); |
|
51 |
void InitializeSigns(); |
|
52 |
void InitializeStations(); |
|
7010
6f0d9f03180d
(svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
rubidium
parents:
6879
diff
changeset
|
53 |
void InitializeCargoPackets(); |
6247 | 54 |
void InitializePlayers(); |
8965
29a591456a2f
(svn r12757) -Codechange: move all cheat related stuff from all over the place to a single location.
rubidium
parents:
8925
diff
changeset
|
55 |
void InitializeCheats(); |
6247 | 56 |
void InitializeNPF(); |
8987
80d22b9c2a0c
(svn r12782) -Codechange: remove some functions from functions.h and do not statically 'waste' memory when the old name array is not needed anymore.
rubidium
parents:
8975
diff
changeset
|
57 |
void InitializeOldNames(); |
0 | 58 |
|
9409
a4fc0d50c588
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
rubidium
parents:
9359
diff
changeset
|
59 |
void InitializeGame(uint size_x, uint size_y, bool reset_date) |
0 | 60 |
{ |
2051 | 61 |
AllocateMap(size_x, size_y); |
62 |
||
7889
e74ce8853ba7
(svn r11440) -Codechange: replace magic numbers with enumified WindowHighlightMode constants. Patch by SmatZ.
rubidium
parents:
7626
diff
changeset
|
63 |
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0); |
0 | 64 |
|
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6201
diff
changeset
|
65 |
_pause_game = 0; |
0 | 66 |
_fast_forward = 0; |
67 |
_tick_counter = 0; |
|
7018
71e174292e42
(svn r10276) -Codechange: made a counter based on milliseconds and independent of the game-state to base double-click and TGP Generation Process on
truelight
parents:
7010
diff
changeset
|
68 |
_realtime_tick = 0; |
0 | 69 |
_date_fract = 0; |
70 |
_cur_tileloop_tile = 0; |
|
9413
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9409
diff
changeset
|
71 |
_settings_game = _settings_newgame; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
72 |
|
9409
a4fc0d50c588
(svn r13320) -Codechange: move some enums from openttd.h to more logical locations.
rubidium
parents:
9359
diff
changeset
|
73 |
if (reset_date) { |
9413
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9409
diff
changeset
|
74 |
SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1)); |
9087
263ff8feb85a
(svn r12946) -Fix: do not allocate the OldNames table when creating a new game as it won't be used anyway.
rubidium
parents:
9005
diff
changeset
|
75 |
InitializeOldNames(); |
0 | 76 |
} |
77 |
||
2848 | 78 |
InitializeEngines(); |
0 | 79 |
InitializeVehicles(); |
1542
62a03537ad0b
(svn r2046) -Codechange: moved all waypoint code to waypoint.c/waypoint.h
truelight
parents:
1538
diff
changeset
|
80 |
InitializeWaypoints(); |
4347
38fc1b161e89
(svn r6048) -Codechange: all InitializeXXX are plural, just not Depot
truelight
parents:
4344
diff
changeset
|
81 |
InitializeDepots(); |
1024
5e446b5b3ec5
(svn r1525) -Codechange: rewrote the _order_array, now it can be made dynamic.
truelight
parents:
1009
diff
changeset
|
82 |
InitializeOrders(); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
6491
diff
changeset
|
83 |
InitializeGroup(); |
0 | 84 |
|
85 |
InitNewsItemStructs(); |
|
2051 | 86 |
InitializeLandscape(); |
0 | 87 |
InitializeClearLand(); |
88 |
InitializeRailGui(); |
|
89 |
InitializeRoadGui(); |
|
90 |
InitializeAirportGui(); |
|
91 |
InitializeDockGui(); |
|
92 |
InitializeTowns(); |
|
93 |
InitializeTrees(); |
|
988
4304525d1b8b
(svn r1486) -Codechange: moved all 'signs' stuff to signs.c/h and prepared it for
truelight
parents:
983
diff
changeset
|
94 |
InitializeSigns(); |
0 | 95 |
InitializeStations(); |
7010
6f0d9f03180d
(svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
rubidium
parents:
6879
diff
changeset
|
96 |
InitializeCargoPackets(); |
0 | 97 |
InitializeIndustries(); |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
98 |
InitializeBuildingCounts(); |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
99 |
|
0 | 100 |
InitializeTrains(); |
1247 | 101 |
InitializeNPF(); |
0 | 102 |
|
2706
fc872b9b17a7
(svn r3250) -Fix: AIs weren't uninitialized when a new game was loaded
truelight
parents:
2685
diff
changeset
|
103 |
AI_Initialize(); |
0 | 104 |
InitializePlayers(); |
105 |
InitializeCheats(); |
|
106 |
||
107 |
InitTextEffects(); |
|
7454
e55eea8c05c7
(svn r10932) -Codechange: replace "text" with "chat" for the chat related function and variables.
rubidium
parents:
7018
diff
changeset
|
108 |
InitChatMessage(); |
0 | 109 |
InitializeAnimatedTiles(); |
110 |
||
111 |
InitializeLandscapeVariables(false); |
|
112 |
||
113 |
ResetObjectToPlace(); |
|
9457
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9413
diff
changeset
|
114 |
|
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9413
diff
changeset
|
115 |
GamelogReset(); |
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9413
diff
changeset
|
116 |
GamelogStartAction(GLAT_START); |
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9413
diff
changeset
|
117 |
GamelogRevision(); |
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9413
diff
changeset
|
118 |
GamelogMode(); |
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9413
diff
changeset
|
119 |
GamelogGRFAddList(_grfconfig); |
75f11a6caef8
(svn r13375) -Add: logging of actions that could possibly cause desyncs and crashes to simplify debugging. See readme.txt for details
smatz
parents:
9413
diff
changeset
|
120 |
GamelogStopAction(); |
0 | 121 |
} |
122 |
||
5108
aeaef6fe53b7
(svn r7182) -Feature: Merge utf8 branch. This brings us support for Unicode/UTF-8 and the option for fonts rendered by FreeType. Language changes to come.
peter1138
parents:
5016
diff
changeset
|
123 |
|
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6091
diff
changeset
|
124 |
/* Calculate constants that depend on the landscape type. */ |
0 | 125 |
void InitializeLandscapeVariables(bool only_constants) |
126 |
{ |
|
6091
c8827d9ae04a
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
5971
diff
changeset
|
127 |
if (only_constants) return; |
201
c40d343115f8
(svn r202) -Codechange: I missed some files with trailing spaces.. this should be
truelight
parents:
179
diff
changeset
|
128 |
|
6350
04b19f551aec
(svn r9388) -Codechange: variable scope and type, and standardify all CargoID loops.
peter1138
parents:
6332
diff
changeset
|
129 |
for (CargoID i = 0; i < NUM_CARGO; i++) { |
6091
c8827d9ae04a
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
5971
diff
changeset
|
130 |
_cargo_payment_rates[i] = GetCargo(i)->initial_payment; |
c8827d9ae04a
(svn r8826) -Codechange: Replace _cargoc's separate arrays with a regular struct array (with accessor) and implement new initialization method using cargo labels.
peter1138
parents:
5971
diff
changeset
|
131 |
_cargo_payment_rates_frac[i] = 0; |
0 | 132 |
} |
133 |
} |
|
134 |
||
135 |
static const SaveLoadGlobVarList _date_desc[] = { |
|
4383
f1e2d6c7527e
(svn r6136) -Fix: _cur_year wasn't converting when reading pre-31 savegames, causing nasty desyncs
truelight
parents:
4347
diff
changeset
|
136 |
SLEG_CONDVAR(_date, SLE_FILE_U16 | SLE_VAR_I32, 0, 30), |
f1e2d6c7527e
(svn r6136) -Fix: _cur_year wasn't converting when reading pre-31 savegames, causing nasty desyncs
truelight
parents:
4347
diff
changeset
|
137 |
SLEG_CONDVAR(_date, SLE_INT32, 31, SL_MAX_VERSION), |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
138 |
SLEG_VAR(_date_fract, SLE_UINT16), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
139 |
SLEG_VAR(_tick_counter, SLE_UINT16), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
140 |
SLEG_VAR(_vehicle_id_ctr_day, SLE_UINT16), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
141 |
SLEG_VAR(_age_cargo_skip_counter, SLE_UINT8), |
5971 | 142 |
SLE_CONDNULL(1, 0, 45), |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
143 |
SLEG_CONDVAR(_cur_tileloop_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
144 |
SLEG_CONDVAR(_cur_tileloop_tile, SLE_UINT32, 6, SL_MAX_VERSION), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
145 |
SLEG_VAR(_disaster_delay, SLE_UINT16), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
146 |
SLEG_VAR(_station_tick_ctr, SLE_UINT16), |
8434
558c39956ba2
(svn r12004) -Codechange: refactor the random functions to reduce code duplication.
rubidium
parents:
8376
diff
changeset
|
147 |
SLEG_VAR(_random.state[0], SLE_UINT32), |
558c39956ba2
(svn r12004) -Codechange: refactor the random functions to reduce code duplication.
rubidium
parents:
8376
diff
changeset
|
148 |
SLEG_VAR(_random.state[1], SLE_UINT32), |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
149 |
SLEG_CONDVAR(_cur_town_ctr, SLE_FILE_U8 | SLE_VAR_U32, 0, 9), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
150 |
SLEG_CONDVAR(_cur_town_ctr, SLE_UINT32, 10, SL_MAX_VERSION), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
151 |
SLEG_VAR(_cur_player_tick_index, SLE_FILE_U8 | SLE_VAR_U32), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
152 |
SLEG_VAR(_next_competitor_start, SLE_FILE_U16 | SLE_VAR_U32), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
153 |
SLEG_VAR(_trees_tick_ctr, SLE_UINT8), |
6231
ff7454d35935
(svn r9034) -Codechange: renamed _pause to _pause_game, as some targets already have
truelight
parents:
6201
diff
changeset
|
154 |
SLEG_CONDVAR(_pause_game, SLE_UINT8, 4, SL_MAX_VERSION), |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
155 |
SLEG_CONDVAR(_cur_town_iter, SLE_UINT32, 11, SL_MAX_VERSION), |
3046
baa216f9911a
(svn r3626) - Merge the SlGlobVarList (global variables) and SaveLoad (offset in struct, variable determined runtime) structs. The only difference between these two is the last element that either holds the address or the offset in the struct. Which one to take is determined by which function is called; SlObject or SlGlobList.
Darkvater
parents:
3033
diff
changeset
|
156 |
SLEG_END() |
0 | 157 |
}; |
158 |
||
6201
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6091
diff
changeset
|
159 |
/* Save load date related variables as well as persistent tick counters |
bee01dc45e39
(svn r8987) -Cleanup: doxygen changes. Again. Mostly (still) @files missing tags and (more than just) a few comments style.
belugas
parents:
6091
diff
changeset
|
160 |
* XXX: currently some unrelated stuff is just put here */ |
6247 | 161 |
static void SaveLoad_DATE() |
0 | 162 |
{ |
163 |
SlGlobList(_date_desc); |
|
164 |
} |
|
165 |
||
166 |
||
167 |
static const SaveLoadGlobVarList _view_desc[] = { |
|
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
168 |
SLEG_CONDVAR(_saved_scrollpos_x, SLE_FILE_I16 | SLE_VAR_I32, 0, 5), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
169 |
SLEG_CONDVAR(_saved_scrollpos_x, SLE_INT32, 6, SL_MAX_VERSION), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
170 |
SLEG_CONDVAR(_saved_scrollpos_y, SLE_FILE_I16 | SLE_VAR_I32, 0, 5), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
171 |
SLEG_CONDVAR(_saved_scrollpos_y, SLE_INT32, 6, SL_MAX_VERSION), |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
172 |
SLEG_VAR(_saved_scrollpos_zoom, SLE_UINT8), |
3046
baa216f9911a
(svn r3626) - Merge the SlGlobVarList (global variables) and SaveLoad (offset in struct, variable determined runtime) structs. The only difference between these two is the last element that either holds the address or the offset in the struct. Which one to take is determined by which function is called; SlObject or SlGlobList.
Darkvater
parents:
3033
diff
changeset
|
173 |
SLEG_END() |
0 | 174 |
}; |
175 |
||
6247 | 176 |
static void SaveLoad_VIEW() |
0 | 177 |
{ |
178 |
SlGlobList(_view_desc); |
|
179 |
} |
|
180 |
||
1218 | 181 |
static uint32 _map_dim_x; |
182 |
static uint32 _map_dim_y; |
|
183 |
||
184 |
static const SaveLoadGlobVarList _map_dimensions[] = { |
|
3046
baa216f9911a
(svn r3626) - Merge the SlGlobVarList (global variables) and SaveLoad (offset in struct, variable determined runtime) structs. The only difference between these two is the last element that either holds the address or the offset in the struct. Which one to take is determined by which function is called; SlObject or SlGlobList.
Darkvater
parents:
3033
diff
changeset
|
185 |
SLEG_CONDVAR(_map_dim_x, SLE_UINT32, 6, SL_MAX_VERSION), |
baa216f9911a
(svn r3626) - Merge the SlGlobVarList (global variables) and SaveLoad (offset in struct, variable determined runtime) structs. The only difference between these two is the last element that either holds the address or the offset in the struct. Which one to take is determined by which function is called; SlObject or SlGlobList.
Darkvater
parents:
3033
diff
changeset
|
186 |
SLEG_CONDVAR(_map_dim_y, SLE_UINT32, 6, SL_MAX_VERSION), |
baa216f9911a
(svn r3626) - Merge the SlGlobVarList (global variables) and SaveLoad (offset in struct, variable determined runtime) structs. The only difference between these two is the last element that either holds the address or the offset in the struct. Which one to take is determined by which function is called; SlObject or SlGlobList.
Darkvater
parents:
3033
diff
changeset
|
187 |
SLEG_END() |
1218 | 188 |
}; |
189 |
||
6247 | 190 |
static void Save_MAPS() |
1218 | 191 |
{ |
1219
1163c59b8650
(svn r1723) Save the map size in tiles, not number of bits
tron
parents:
1218
diff
changeset
|
192 |
_map_dim_x = MapSizeX(); |
1163c59b8650
(svn r1723) Save the map size in tiles, not number of bits
tron
parents:
1218
diff
changeset
|
193 |
_map_dim_y = MapSizeY(); |
1218 | 194 |
SlGlobList(_map_dimensions); |
195 |
} |
|
196 |
||
6247 | 197 |
static void Load_MAPS() |
1218 | 198 |
{ |
199 |
SlGlobList(_map_dimensions); |
|
2051 | 200 |
AllocateMap(_map_dim_x, _map_dim_y); |
1218 | 201 |
} |
202 |
||
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
203 |
enum { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
204 |
MAP_SL_BUF_SIZE = 4096 |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
205 |
}; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
206 |
|
6247 | 207 |
static void Load_MAPT() |
2050
3b37e813823a
(svn r2559) Cleaned up new saveload code for the map
ludde
parents:
2049
diff
changeset
|
208 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
209 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
210 |
TileIndex size = MapSize(); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
211 |
|
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
212 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
213 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
214 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _m[i++].type_height = buf[j]; |
817
238bbdaa228b
(svn r1288) -Codechange: changed _map2 to an uint16. It is still saved and loaded as
truelight
parents:
785
diff
changeset
|
215 |
} |
0 | 216 |
} |
217 |
||
6247 | 218 |
static void Save_MAPT() |
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1024
diff
changeset
|
219 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
220 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
221 |
TileIndex size = MapSize(); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
222 |
|
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
223 |
SlSetLength(size); |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
224 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
225 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _m[i++].type_height; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
226 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
227 |
} |
0 | 228 |
} |
229 |
||
6247 | 230 |
static void Load_MAP1() |
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1024
diff
changeset
|
231 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
232 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
233 |
TileIndex size = MapSize(); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
234 |
|
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
235 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
236 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
237 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _m[i++].m1 = buf[j]; |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
238 |
} |
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
239 |
} |
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
240 |
|
6247 | 241 |
static void Save_MAP1() |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
242 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
243 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
244 |
TileIndex size = MapSize(); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
245 |
|
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
246 |
SlSetLength(size); |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
247 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
248 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _m[i++].m1; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
249 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
250 |
} |
0 | 251 |
} |
252 |
||
6247 | 253 |
static void Load_MAP2() |
1093
4fdc46eaf423
(svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents:
1024
diff
changeset
|
254 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
255 |
SmallStackSafeStackAlloc<uint16, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
256 |
TileIndex size = MapSize(); |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
257 |
|
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
258 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
259 |
SlArray(buf, MAP_SL_BUF_SIZE, |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
260 |
/* In those versions the m2 was 8 bits */ |
2685
805a28b7c3b7
(svn r3227) -Codechange: [Savegame] removed 'minor' version, and renamed 'major' version to just: version.
truelight
parents:
2548
diff
changeset
|
261 |
CheckSavegameVersion(5) ? SLE_FILE_U8 | SLE_VAR_U16 : SLE_UINT16 |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
262 |
); |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
263 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _m[i++].m2 = buf[j]; |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
264 |
} |
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
265 |
} |
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
266 |
|
6247 | 267 |
static void Save_MAP2() |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
268 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
269 |
SmallStackSafeStackAlloc<uint16, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
270 |
TileIndex size = MapSize(); |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
271 |
|
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
272 |
SlSetLength(size * sizeof(uint16)); |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
273 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
274 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _m[i++].m2; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
275 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT16); |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
276 |
} |
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
277 |
} |
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
278 |
|
6247 | 279 |
static void Load_MAP3() |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
280 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
281 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
282 |
TileIndex size = MapSize(); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
283 |
|
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
284 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
285 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
286 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _m[i++].m3 = buf[j]; |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
287 |
} |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
288 |
} |
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
289 |
|
6247 | 290 |
static void Save_MAP3() |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
291 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
292 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
293 |
TileIndex size = MapSize(); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
294 |
|
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
295 |
SlSetLength(size); |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
296 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
297 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _m[i++].m3; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
298 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
299 |
} |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
300 |
} |
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
301 |
|
6247 | 302 |
static void Load_MAP4() |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
303 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
304 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
305 |
TileIndex size = MapSize(); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
306 |
|
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
307 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
308 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
309 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _m[i++].m4 = buf[j]; |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
310 |
} |
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
311 |
} |
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
312 |
|
6247 | 313 |
static void Save_MAP4() |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
314 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
315 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
316 |
TileIndex size = MapSize(); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
317 |
|
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
318 |
SlSetLength(size); |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
319 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
320 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _m[i++].m4; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
321 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
322 |
} |
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
323 |
} |
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
324 |
|
6247 | 325 |
static void Load_MAP5() |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
326 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
327 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
328 |
TileIndex size = MapSize(); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
329 |
|
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
330 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
331 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
332 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _m[i++].m5 = buf[j]; |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
333 |
} |
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
334 |
} |
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
335 |
|
6247 | 336 |
static void Save_MAP5() |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
337 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
338 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
339 |
TileIndex size = MapSize(); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
340 |
|
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
341 |
SlSetLength(size); |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
342 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
343 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _m[i++].m5; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
344 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
2295
95e8858e9938
(svn r2819) Make variables, which are exclusive for internal use of the save/load code, static in saveload.c
tron
parents:
2293
diff
changeset
|
345 |
} |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
346 |
} |
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
347 |
|
6247 | 348 |
static void Load_MAP6() |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
349 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
350 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
351 |
TileIndex size = MapSize(); |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
352 |
|
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
5108
diff
changeset
|
353 |
if (CheckSavegameVersion(42)) { |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
354 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
355 |
/* 1024, otherwise we overflow on 64x64 maps! */ |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
356 |
SlArray(buf, 1024, SLE_UINT8); |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
357 |
for (uint j = 0; j != 1024; j++) { |
5596
5bf7128140a0
(svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden.
belugas
parents:
5587
diff
changeset
|
358 |
_m[i++].m6 = GB(buf[j], 0, 2); |
5bf7128140a0
(svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden.
belugas
parents:
5587
diff
changeset
|
359 |
_m[i++].m6 = GB(buf[j], 2, 2); |
5bf7128140a0
(svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden.
belugas
parents:
5587
diff
changeset
|
360 |
_m[i++].m6 = GB(buf[j], 4, 2); |
5bf7128140a0
(svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden.
belugas
parents:
5587
diff
changeset
|
361 |
_m[i++].m6 = GB(buf[j], 6, 2); |
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
5108
diff
changeset
|
362 |
} |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
5108
diff
changeset
|
363 |
} |
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
5108
diff
changeset
|
364 |
} else { |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
365 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
366 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
367 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _m[i++].m6 = buf[j]; |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
368 |
} |
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
369 |
} |
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
370 |
} |
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
371 |
|
6247 | 372 |
static void Save_MAP6() |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
373 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
374 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
375 |
TileIndex size = MapSize(); |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
376 |
|
5385
3868f2e6db9b
(svn r7573) -Merged the bridge branch. Allows to build bridges of arbitrary rail/road combinations (including signals)
celestar
parents:
5108
diff
changeset
|
377 |
SlSetLength(size); |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
378 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
379 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _m[i++].m6; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
380 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
2049
538e73c53f54
(svn r2558) Change the internal map format from 7 arrays to one array of structs, this doesn't change the saved format for now. It's a stepping stone for further changes.
tron
parents:
1999
diff
changeset
|
381 |
} |
0 | 382 |
} |
383 |
||
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
384 |
static void Load_MAP7() |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
385 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
386 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
387 |
TileIndex size = MapSize(); |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
388 |
|
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
389 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
390 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
391 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) _me[i++].m7 = buf[j]; |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
392 |
} |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
393 |
} |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
394 |
|
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
395 |
static void Save_MAP7() |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
396 |
{ |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
397 |
SmallStackSafeStackAlloc<byte, MAP_SL_BUF_SIZE> buf; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
398 |
TileIndex size = MapSize(); |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
399 |
|
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
400 |
SlSetLength(size); |
8376
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
401 |
for (TileIndex i = 0; i != size;) { |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
402 |
for (uint j = 0; j != MAP_SL_BUF_SIZE; j++) buf[j] = _me[i++].m7; |
aab0b14b96e3
(svn r11943) -Codechange: add and use a simple structure to support small stacks by allocating it on the heap or pushing a few kB of data onto the stack when there is a large stack.
rubidium
parents:
8264
diff
changeset
|
403 |
SlArray(buf, MAP_SL_BUF_SIZE, SLE_UINT8); |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
404 |
} |
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
405 |
} |
0 | 406 |
|
5587
167d9a91ef02
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents:
5584
diff
changeset
|
407 |
extern const ChunkHandler _misc_chunk_handlers[] = { |
4344
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
408 |
{ 'MAPS', Save_MAPS, Load_MAPS, CH_RIFF }, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
409 |
{ 'MAPT', Save_MAPT, Load_MAPT, CH_RIFF }, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
410 |
{ 'MAPO', Save_MAP1, Load_MAP1, CH_RIFF }, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
411 |
{ 'MAP2', Save_MAP2, Load_MAP2, CH_RIFF }, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
412 |
{ 'M3LO', Save_MAP3, Load_MAP3, CH_RIFF }, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
413 |
{ 'M3HI', Save_MAP4, Load_MAP4, CH_RIFF }, |
7e123fec5b0b
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4326
diff
changeset
|
414 |
{ 'MAP5', Save_MAP5, Load_MAP5, CH_RIFF }, |
5596
5bf7128140a0
(svn r8050) -Codechange: Rename map member extra to m6, since its usage has been widden.
belugas
parents:
5587
diff
changeset
|
415 |
{ 'MAPE', Save_MAP6, Load_MAP6, CH_RIFF }, |
6332
f3f436dcd7d0
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
maedhros
parents:
6247
diff
changeset
|
416 |
{ 'MAP7', Save_MAP7, Load_MAP7, CH_RIFF }, |
0 | 417 |
|
418 |
{ 'DATE', SaveLoad_DATE, SaveLoad_DATE, CH_RIFF}, |
|
8965
29a591456a2f
(svn r12757) -Codechange: move all cheat related stuff from all over the place to a single location.
rubidium
parents:
8925
diff
changeset
|
419 |
{ 'VIEW', SaveLoad_VIEW, SaveLoad_VIEW, CH_RIFF | CH_LAST}, |
0 | 420 |
}; |