# misc.cpp

Go to the documentation of this file.

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