Update readme and changelog for v1.27.0
[openttd-joker.git] / src / misc.cpp
blobdbe19c9bf0bfd3eb8b34ed5aed4720ec6c019bd4
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"
31 #include "command_func.h"
32 #include "viewport_func.h"
33 #include "tracerestrict.h"
34 #include "logic_signals.h"
35 #include "bridge_signal_map.h"
36 #include "zoning.h"
38 #include "safeguards.h"
41 extern TileIndex _cur_tileloop_tile;
42 extern void MakeNewgameSettingsLive();
44 void InitializeSound();
45 void InitializeMusic();
46 void InitializeVehicles();
47 void InitializeRailGui();
48 void InitializeRoadGui();
49 void InitializeAirportGui();
50 void InitializeDockGui();
51 void InitializeObjectGui();
52 void InitializeIndustries();
53 void InitializeObjects();
54 void InitializeTrees();
55 void InitializeCompanies();
56 void InitializeCheats();
57 void InitializeNPF();
58 void InitializeOldNames();
60 void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings)
62 /* Make sure there isn't any window that can influence anything
63 * related to the new game we're about to start/load. */
64 UnInitWindowSystem();
66 AllocateMap(size_x, size_y);
68 ClearCommandLog();
70 ViewportMapClearTunnelCache();
72 _pause_mode = PM_UNPAUSED;
73 _fast_forward = 0;
74 _tick_counter = 0;
75 _cur_tileloop_tile = 1;
76 _thd.redsq = INVALID_TILE;
77 if (reset_settings) MakeNewgameSettingsLive();
79 if (reset_date) {
80 SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1), 0);
81 InitializeOldNames();
84 LinkGraphSchedule::Clear();
85 ClearTraceRestrictMapping();
86 ClearBridgeSimulatedSignalMapping();
87 PoolBase::Clean(PT_NORMAL);
89 ClearZoningCaches();
90 ResetPersistentNewGRFData();
92 InitializeSound();
93 InitializeMusic();
95 InitializeVehicles();
97 InitNewsItemStructs();
98 InitializeLandscape();
99 InitializeRailGui();
100 InitializeRoadGui();
101 InitializeAirportGui();
102 InitializeDockGui();
103 InitializeObjectGui();
104 InitializeAIGui();
105 InitializeTrees();
106 InitializeIndustries();
107 InitializeObjects();
108 InitializeBuildingCounts();
110 FreeAllSignalPrograms();
112 InitializeNPF();
114 InitializeCompanies();
115 AI::Initialize();
116 Game::Initialize();
117 InitializeCheats();
119 InitTextEffects();
120 #ifdef ENABLE_NETWORK
121 NetworkInitChatMessage();
122 #endif /* ENABLE_NETWORK */
123 InitializeAnimatedTiles();
125 InitializeEconomy();
127 ResetObjectToPlace();
128 ResetRailPlacementSnapping();
130 GamelogReset();
131 GamelogStartAction(GLAT_START);
132 GamelogRevision();
133 GamelogMode();
134 GamelogGRFAddList(_grfconfig);
135 GamelogStopAction();