# misc.cpp

Go to the documentation of this file.

    00001 /* $Id: misc.cpp 18608 2009-12-22 21:40:29Z rubidium $ */
    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 "variables.h"
    00016 #include "ai/ai.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
    00029
    00030 extern TileIndex _cur_tileloop_tile;
    00031 extern void MakeNewgameSettingsLive();
    00032
    00033 void InitializeSound();
    00034 void InitializeMusic();
    00035 void InitializeVehicles();
    00036 void InitializeDepots();
    00037 void InitializeEngineRenews();
    00038 void InitializeOrders();
    00039 void InitializeClearLand();
    00040 void InitializeRailGui();
    00041 void InitializeRoadGui();
    00042 void InitializeAirportGui();
    00043 void InitializeDockGui();
    00044 void InitializeIndustries();
    00045 void InitializeTowns();
    00046 void InitializeSubsidies();
    00047 void InitializeTrees();
    00048 void InitializeSigns();
    00049 void InitializeStations();
    00050 void InitializeRoadStops();
    00051 void InitializeCargoPackets();
    00052 void InitializeCompanies();
    00053 void InitializeCheats();
    00054 void InitializeNPF();
    00055 void InitializeOldNames();
    00056
    00057 void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings)
    00058 {
    00059   /* Make sure there isn't any window that can influence anything
    00060    * related to the new game we're about to start/load. */
    00061   UnInitWindowSystem();
    00062
    00063   AllocateMap(size_x, size_y);
    00064
    00065   _pause_mode = PM_UNPAUSED;
    00066   _fast_forward = 0;
    00067   _tick_counter = 0;
    00068   _realtime_tick = 0;
    00069   _date_fract = 0;
    00070   _cur_tileloop_tile = 0;
    00071   _thd.redsq = INVALID_TILE;
    00072   if (reset_settings) MakeNewgameSettingsLive();
    00073
    00074   InitializeSound();
    00075   InitializeMusic();
    00076
    00077   if (reset_date) {
    00078     SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
    00079     InitializeOldNames();
    00080   }
    00081
    00082   InitializeEngineRenews();
    00083   InitializeVehicles();
    00084   InitializeDepots();
    00085   InitializeOrders();
    00086   InitializeGroup();
    00087
    00088   InitNewsItemStructs();
    00089   InitializeLandscape();
    00090   InitializeClearLand();
    00091   InitializeRailGui();
    00092   InitializeRoadGui();
    00093   InitializeAirportGui();
    00094   InitializeDockGui();
    00095   InitializeTowns();
    00096   InitializeSubsidies();
    00097   InitializeTrees();
    00098   InitializeSigns();
    00099   InitializeStations();
    00100   InitializeRoadStops();
    00101   InitializeCargoPackets();
    00102   InitializeIndustries();
    00103   InitializeBuildingCounts();
    00104
    00105   InitializeNPF();
    00106
    00107   InitializeCompanies();
    00108   AI::Initialize();
    00109   InitializeCheats();
    00110
    00111   InitTextEffects();
    00112 #ifdef ENABLE_NETWORK
    00113   NetworkInitChatMessage();
    00114 #endif /* ENABLE_NETWORK */
    00115   InitializeAnimatedTiles();
    00116
    00117   InitializeEconomy();
    00118
    00119   ResetObjectToPlace();
    00120
    00121   GamelogReset();
    00122   GamelogStartAction(GLAT_START);
    00123   GamelogRevision();
    00124   GamelogMode();
    00125   GamelogGRFAddList(_grfconfig);
    00126   GamelogStopAction();
    00127 }