# misc.cpp

Go to the documentation of this file.

    00001 /* $Id: misc.cpp 24132 2012-04-17 19:43:43Z michi_cc $ */
    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 "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 #include "game/game.hpp"
    00030
    00031
    00032 extern TileIndex _cur_tileloop_tile;
    00033 extern void MakeNewgameSettingsLive();
    00034
    00035 void InitializeSound();
    00036 void InitializeMusic();
    00037 void InitializeVehicles();
    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
    00051 void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings)
    00052 {
    00053   /* Make sure there isn't any window that can influence anything
    00054    * related to the new game we're about to start/load. */
    00055   UnInitWindowSystem();
    00056
    00057   AllocateMap(size_x, size_y);
    00058
    00059   _pause_mode = PM_UNPAUSED;
    00060   _fast_forward = 0;
    00061   _tick_counter = 0;
    00062   _cur_tileloop_tile = 1;
    00063   _thd.redsq = INVALID_TILE;
    00064   if (reset_settings) MakeNewgameSettingsLive();
    00065
    00066   if (reset_date) {
    00067     SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1), 0);
    00068     InitializeOldNames();
    00069   }
    00070
    00071   PoolBase::Clean(PT_NORMAL);
    00072
    00073   ResetPersistentNewGRFData();
    00074
    00075   InitializeSound();
    00076   InitializeMusic();
    00077
    00078   InitializeVehicles();
    00079
    00080   InitNewsItemStructs();
    00081   InitializeLandscape();
    00082   InitializeRailGui();
    00083   InitializeRoadGui();
    00084   InitializeAirportGui();
    00085   InitializeDockGui();
    00086   InitializeObjectGui();
    00087   InitializeAIGui();
    00088   InitializeTrees();
    00089   InitializeIndustries();
    00090   InitializeObjects();
    00091   InitializeBuildingCounts();
    00092
    00093   InitializeNPF();
    00094
    00095   InitializeCompanies();
    00096   AI::Initialize();
    00097   Game::Initialize();
    00098   InitializeCheats();
    00099
    00100   InitTextEffects();
    00101 #ifdef ENABLE_NETWORK
    00102   NetworkInitChatMessage();
    00103 #endif /* ENABLE_NETWORK */
    00104   InitializeAnimatedTiles();
    00105
    00106   InitializeEconomy();
    00107
    00108   ResetObjectToPlace();
    00109
    00110   GamelogReset();
    00111   GamelogStartAction(GLAT_START);
    00112   GamelogRevision();
    00113   GamelogMode();
    00114   GamelogGRFAddList(_grfconfig);
    00115   GamelogStopAction();
    00116 }