00001 /* $Id$ */ 00002 00003 /* 00004 * This file is part of OpenTTD. 00005 * 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. 00006 * 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. 00007 * 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/>. 00008 */ 00009 00012 #include "stdafx.h" 00013 #include "landscape.h" 00014 #include "news_func.h" 00015 #include "ai/ai.hpp" 00016 #include "ai/ai_gui.hpp" 00017 #include "newgrf.h" 00018 #include "newgrf_house.h" 00019 #include "group.h" 00020 #include "economy_func.h" 00021 #include "date_func.h" 00022 #include "texteff.hpp" 00023 #include "gfx_func.h" 00024 #include "gamelog.h" 00025 #include "animated_tile_func.h" 00026 #include "tilehighlight_func.h" 00027 #include "network/network_func.h" 00028 #include "window_func.h" 00029 #include "core/pool_type.hpp" 00030 #include "game/game.hpp" 00031 00032 00033 extern TileIndex _cur_tileloop_tile; 00034 extern void MakeNewgameSettingsLive(); 00035 00036 void InitializeSound(); 00037 void InitializeMusic(); 00038 void InitializeVehicles(); 00039 void InitializeRailGui(); 00040 void InitializeRoadGui(); 00041 void InitializeAirportGui(); 00042 void InitializeDockGui(); 00043 void InitializeObjectGui(); 00044 void InitializeIndustries(); 00045 void InitializeObjects(); 00046 void InitializeTrees(); 00047 void InitializeCompanies(); 00048 void InitializeCheats(); 00049 void InitializeNPF(); 00050 void InitializeOldNames(); 00051 void InitializeLinkGraphs(); 00052 00053 void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings) 00054 { 00055 /* Make sure there isn't any window that can influence anything 00056 * related to the new game we're about to start/load. */ 00057 UnInitWindowSystem(); 00058 00059 AllocateMap(size_x, size_y); 00060 00061 _pause_mode = PM_UNPAUSED; 00062 _fast_forward = 0; 00063 _tick_counter = 0; 00064 _cur_tileloop_tile = 0; 00065 _thd.redsq = INVALID_TILE; 00066 if (reset_settings) MakeNewgameSettingsLive(); 00067 00068 if (reset_date) { 00069 SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1), 0); 00070 InitializeOldNames(); 00071 } 00072 00073 PoolBase::Clean(PT_NORMAL); 00074 00075 ResetPersistentNewGRFData(); 00076 00077 InitializeSound(); 00078 InitializeMusic(); 00079 00080 InitializeVehicles(); 00081 00082 InitNewsItemStructs(); 00083 InitializeLandscape(); 00084 InitializeRailGui(); 00085 InitializeRoadGui(); 00086 InitializeAirportGui(); 00087 InitializeDockGui(); 00088 InitializeObjectGui(); 00089 InitializeAIGui(); 00090 InitializeTrees(); 00091 InitializeIndustries(); 00092 InitializeObjects(); 00093 InitializeBuildingCounts(); 00094 00095 InitializeNPF(); 00096 00097 InitializeCompanies(); 00098 AI::Initialize(); 00099 Game::Initialize(); 00100 InitializeCheats(); 00101 00102 InitTextEffects(); 00103 #ifdef ENABLE_NETWORK 00104 NetworkInitChatMessage(); 00105 #endif /* ENABLE_NETWORK */ 00106 InitializeAnimatedTiles(); 00107 00108 InitializeLinkGraphs(); 00109 InitializeEconomy(); 00110 00111 ResetObjectToPlace(); 00112 00113 GamelogReset(); 00114 GamelogStartAction(GLAT_START); 00115 GamelogRevision(); 00116 GamelogMode(); 00117 GamelogGRFAddList(_grfconfig); 00118 GamelogStopAction(); 00119 }