# misc.cpp

Go to the documentation of this file.

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