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