Rearrange storage of reserved tracks for railway tiles
[openttd/fttd.git] / src / misc.cpp
blob4d38be694a48002229b6fa9c98e4bb86aa39634c
1 /* $Id$ */
3 /*
4 * This file is part of OpenTTD.
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8 */
10 /** @file misc.cpp Misc functions that shouldn't be here. */
12 #include "stdafx.h"
13 #include "landscape.h"
14 #include "news_func.h"
15 #include "ai/ai.hpp"
16 #include "ai/ai_gui.hpp"
17 #include "newgrf.h"
18 #include "newgrf_house.h"
19 #include "economy_func.h"
20 #include "date_func.h"
21 #include "texteff.hpp"
22 #include "gfx_func.h"
23 #include "gamelog.h"
24 #include "animated_tile_func.h"
25 #include "tilehighlight_func.h"
26 #include "network/network_func.h"
27 #include "window_func.h"
28 #include "core/pool_type.hpp"
29 #include "game/game.hpp"
30 #include "linkgraph/linkgraphschedule.h"
33 extern TileIndex _cur_tileloop_tile;
34 extern void MakeNewgameSettingsLive();
36 void InitializeSound();
37 void InitializeMusic();
38 void InitializeVehicles();
39 void InitializeRailGui();
40 void InitializeRoadGui();
41 void InitializeAirportGui();
42 void InitializeDockGui();
43 void InitializeObjectGui();
44 void InitializeIndustries();
45 void InitializeObjects();
46 void InitializeTrees();
47 void InitializeCompanies();
48 void InitializeCheats();
49 void InitializeOldNames();
51 void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings)
53 /* Make sure there isn't any window that can influence anything
54 * related to the new game we're about to start/load. */
55 UnInitWindowSystem();
57 AllocateMap(size_x, size_y);
59 _pause_mode = PM_UNPAUSED;
60 _fast_forward = 0;
61 _tick_counter = 0;
62 _cur_tileloop_tile = 1;
63 _thd.redsq = INVALID_TILE;
64 if (reset_settings) MakeNewgameSettingsLive();
66 if (reset_date) {
67 SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1), 0);
68 InitializeOldNames();
71 LinkGraphSchedule::Clear();
72 PoolBase::Clean(PT_NORMAL);
74 ResetPersistentNewGRFData();
76 InitializeSound();
77 InitializeMusic();
79 InitializeVehicles();
81 InitNewsItemStructs();
82 InitializeLandscape();
83 InitializeRailGui();
84 InitializeRoadGui();
85 InitializeAirportGui();
86 InitializeDockGui();
87 InitializeObjectGui();
88 InitializeAIGui();
89 InitializeTrees();
90 InitializeIndustries();
91 InitializeObjects();
92 InitializeBuildingCounts();
94 InitializeCompanies();
95 AI::Initialize();
96 Game::Initialize();
97 InitializeCheats();
99 InitTextEffects();
100 #ifdef ENABLE_NETWORK
101 NetworkInitChatMessage();
102 #endif /* ENABLE_NETWORK */
103 InitializeAnimatedTiles();
105 InitializeEconomy();
107 ResetObjectToPlace();
109 GamelogReset();
110 GamelogAddStart();
111 GamelogAddRevision();
112 GamelogAddMode();
113 GamelogGRFAddList(_grfconfig);
114 GamelogAddStarted();