OpenTTD: src/misc.cpp Source File

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

misc.cpp
Go to the documentation of this file.
1 /* $Id: misc.cpp 26482 2014-04-23 20:13:33Z rubidium $ */
2
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 */
9
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
32 #include "safeguards.h"
33
34
35 extern TileIndex _cur_tileloop_tile;
36 extern void MakeNewgameSettingsLive();
37
38 void InitializeSound();
39 void InitializeMusic();
40 void InitializeVehicles();
41 void InitializeRailGui();
42 void InitializeRoadGui();
43 void InitializeAirportGui();
44 void InitializeDockGui();
45 void InitializeObjectGui();
46 void InitializeIndustries();
47 void InitializeObjects();
48 void InitializeTrees();
49 void InitializeCompanies();
50 void InitializeCheats();
51 void InitializeNPF();
52 void InitializeOldNames();
53
54 void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings)
55 {
56 /* Make sure there isn't any window that can influence anything
57 * related to the new game we're about to start/load. */
58 UnInitWindowSystem();
59
60 AllocateMap(size_x, size_y);
61
62 _pause_mode = PM_UNPAUSED;
63 _fast_forward = 0;
64 _tick_counter = 0;
65 _cur_tileloop_tile = 1;
66 _thd.redsq = INVALID_TILE;
67 if (reset_settings) MakeNewgameSettingsLive();
68
69 if (reset_date) {
70 SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1), 0);
71 InitializeOldNames();
72 }
73
74 LinkGraphSchedule::Clear();
75 PoolBase::Clean(PT_NORMAL);
76
77 ResetPersistentNewGRFData();
78
79 InitializeSound();
80 InitializeMusic();
81
82 InitializeVehicles();
83
84 InitNewsItemStructs();
85 InitializeLandscape();
86 InitializeRailGui();
87 InitializeRoadGui();
88 InitializeAirportGui();
89 InitializeDockGui();
90 InitializeObjectGui();
91 InitializeAIGui();
92 InitializeTrees();
93 InitializeIndustries();
94 InitializeObjects();
95 InitializeBuildingCounts();
96
97 InitializeNPF();
98
99 InitializeCompanies();
100 AI::Initialize();
101 Game::Initialize();
102 InitializeCheats();
103
104 InitTextEffects();
105 #ifdef ENABLE_NETWORK
106 NetworkInitChatMessage();
107 #endif /* ENABLE_NETWORK */
108 InitializeAnimatedTiles();
109
110 InitializeEconomy();
111
112 ResetObjectToPlace();
113
114 GamelogReset();
115 GamelogStartAction(GLAT_START);
116 GamelogRevision();
117 GamelogMode();
118 GamelogGRFAddList(_grfconfig);
119 GamelogStopAction();
120 }