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"
33 #include "safeguards.h"
36 extern TileIndex _cur_tileloop_tile
;
37 extern void MakeNewgameSettingsLive();
39 void InitializeSound();
40 void InitializeMusic();
41 void InitializeVehicles();
42 void InitializeRailGui();
43 void InitializeRoadGui();
44 void InitializeAirportGui();
45 void InitializeDockGui();
46 void InitializeGraphGui();
47 void InitializeObjectGui();
48 void InitializeTownGui();
49 void InitializeIndustries();
50 void InitializeObjects();
51 void InitializeTrees();
52 void InitializeCompanies();
53 void InitializeCheats();
55 void InitializeOldNames();
57 void InitializeGame(uint size_x
, uint size_y
, bool reset_date
, bool reset_settings
)
59 /* Make sure there isn't any window that can influence anything
60 * related to the new game we're about to start/load. */
63 AllocateMap(size_x
, size_y
);
65 _pause_mode
= PM_UNPAUSED
;
68 _cur_tileloop_tile
= 1;
69 _thd
.redsq
= INVALID_TILE
;
70 if (reset_settings
) MakeNewgameSettingsLive();
73 SetDate(ConvertYMDToDate(_settings_game
.game_creation
.starting_year
, 0, 1), 0);
77 LinkGraphSchedule::Clear();
78 PoolBase::Clean(PT_NORMAL
);
80 RebuildStationKdtree();
82 RebuildViewportKdtree();
84 ResetPersistentNewGRFData();
91 InitNewsItemStructs();
92 InitializeLandscape();
95 InitializeAirportGui();
98 InitializeObjectGui();
102 InitializeIndustries();
104 InitializeBuildingCounts();
108 InitializeCompanies();
114 NetworkInitChatMessage();
115 InitializeAnimatedTiles();
119 ResetObjectToPlace();
122 GamelogStartAction(GLAT_START
);
125 GamelogGRFAddList(_grfconfig
);