2 * This file is part of OpenTTD.
3 * 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.
4 * 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.
5 * 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 /** @file misc.cpp Misc functions that shouldn't be here. */
11 #include "landscape.h"
12 #include "news_func.h"
14 #include "ai/ai_gui.hpp"
16 #include "newgrf_house.h"
17 #include "economy_func.h"
18 #include "date_func.h"
19 #include "texteff.hpp"
22 #include "animated_tile_func.h"
23 #include "tilehighlight_func.h"
24 #include "network/network_func.h"
25 #include "window_func.h"
26 #include "core/pool_type.hpp"
27 #include "game/game.hpp"
28 #include "linkgraph/linkgraphschedule.h"
29 #include "station_kdtree.h"
30 #include "town_kdtree.h"
31 #include "viewport_kdtree.h"
32 #include "newgrf_profiling.h"
34 #include "safeguards.h"
37 extern TileIndex _cur_tileloop_tile
;
38 extern void MakeNewgameSettingsLive();
40 void InitializeSound();
41 void InitializeMusic();
42 void InitializeVehicles();
43 void InitializeRailGui();
44 void InitializeRoadGui();
45 void InitializeAirportGui();
46 void InitializeDockGui();
47 void InitializeGraphGui();
48 void InitializeObjectGui();
49 void InitializeTownGui();
50 void InitializeIndustries();
51 void InitializeObjects();
52 void InitializeTrees();
53 void InitializeCompanies();
54 void InitializeCheats();
56 void InitializeOldNames();
58 void InitializeGame(uint size_x
, uint size_y
, bool reset_date
, bool reset_settings
)
60 /* Make sure there isn't any window that can influence anything
61 * related to the new game we're about to start/load. */
64 AllocateMap(size_x
, size_y
);
66 _pause_mode
= PM_UNPAUSED
;
69 _cur_tileloop_tile
= 1;
70 _thd
.redsq
= INVALID_TILE
;
71 if (reset_settings
) MakeNewgameSettingsLive();
73 _newgrf_profilers
.clear();
76 SetDate(ConvertYMDToDate(_settings_game
.game_creation
.starting_year
, 0, 1), 0);
80 LinkGraphSchedule::Clear();
81 PoolBase::Clean(PT_NORMAL
);
83 RebuildStationKdtree();
85 RebuildViewportKdtree();
87 ResetPersistentNewGRFData();
94 InitNewsItemStructs();
95 InitializeLandscape();
98 InitializeAirportGui();
100 InitializeGraphGui();
101 InitializeObjectGui();
105 InitializeIndustries();
107 InitializeBuildingCounts();
111 InitializeCompanies();
117 NetworkInitChatMessage();
118 InitializeAnimatedTiles();
122 ResetObjectToPlace();
125 GamelogStartAction(GLAT_START
);
128 GamelogGRFAddList(_grfconfig
);