2005-07-24 14:12:37 +00:00
|
|
|
/* $Id$ */
|
|
|
|
|
2009-08-21 20:21:05 +00:00
|
|
|
/*
|
|
|
|
* This file is part of OpenTTD.
|
|
|
|
* 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.
|
|
|
|
* 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.
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
|
2008-05-06 15:11:33 +00:00
|
|
|
/** @file misc.cpp Misc functions that shouldn't be here. */
|
2007-03-03 04:04:22 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
#include "stdafx.h"
|
2007-04-12 13:07:15 +00:00
|
|
|
#include "landscape.h"
|
2008-03-28 08:53:36 +00:00
|
|
|
#include "news_func.h"
|
2009-01-12 17:11:45 +00:00
|
|
|
#include "ai/ai.hpp"
|
2010-03-15 11:45:15 +00:00
|
|
|
#include "ai/ai_gui.hpp"
|
2007-03-19 11:27:30 +00:00
|
|
|
#include "newgrf_house.h"
|
2007-05-19 09:40:18 +00:00
|
|
|
#include "group.h"
|
2007-12-21 22:50:51 +00:00
|
|
|
#include "economy_func.h"
|
2007-12-26 13:50:40 +00:00
|
|
|
#include "date_func.h"
|
2007-12-27 13:35:39 +00:00
|
|
|
#include "texteff.hpp"
|
2008-01-09 09:45:45 +00:00
|
|
|
#include "gfx_func.h"
|
2008-06-03 18:35:58 +00:00
|
|
|
#include "gamelog.h"
|
2008-04-20 08:22:59 +00:00
|
|
|
#include "animated_tile_func.h"
|
2008-05-07 13:10:15 +00:00
|
|
|
#include "tilehighlight_func.h"
|
2008-08-11 22:45:11 +00:00
|
|
|
#include "network/network_func.h"
|
2009-01-23 23:40:12 +00:00
|
|
|
#include "window_func.h"
|
2008-01-09 09:45:45 +00:00
|
|
|
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-04-18 10:16:51 +00:00
|
|
|
extern TileIndex _cur_tileloop_tile;
|
2009-01-12 17:11:45 +00:00
|
|
|
extern void MakeNewgameSettingsLive();
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2009-08-09 19:50:44 +00:00
|
|
|
void InitializeSound();
|
2009-12-22 21:40:29 +00:00
|
|
|
void InitializeMusic();
|
2007-03-07 11:47:46 +00:00
|
|
|
void InitializeVehicles();
|
|
|
|
void InitializeDepots();
|
2008-09-13 15:49:29 +00:00
|
|
|
void InitializeEngineRenews();
|
2007-03-07 11:47:46 +00:00
|
|
|
void InitializeOrders();
|
2010-08-18 15:15:59 +00:00
|
|
|
void InitializeOrderBackups();
|
2007-03-07 11:47:46 +00:00
|
|
|
void InitializeClearLand();
|
|
|
|
void InitializeRailGui();
|
|
|
|
void InitializeRoadGui();
|
|
|
|
void InitializeAirportGui();
|
|
|
|
void InitializeDockGui();
|
|
|
|
void InitializeIndustries();
|
2010-08-13 12:45:26 +00:00
|
|
|
void InitializeObjects();
|
2007-03-07 11:47:46 +00:00
|
|
|
void InitializeTowns();
|
2009-07-01 18:45:05 +00:00
|
|
|
void InitializeSubsidies();
|
2007-03-07 11:47:46 +00:00
|
|
|
void InitializeTrees();
|
|
|
|
void InitializeSigns();
|
|
|
|
void InitializeStations();
|
2009-06-23 21:44:48 +00:00
|
|
|
void InitializeRoadStops();
|
2007-06-22 11:58:59 +00:00
|
|
|
void InitializeCargoPackets();
|
2008-09-30 20:39:50 +00:00
|
|
|
void InitializeCompanies();
|
2008-04-17 21:21:01 +00:00
|
|
|
void InitializeCheats();
|
2007-03-07 11:47:46 +00:00
|
|
|
void InitializeNPF();
|
2008-04-19 08:21:55 +00:00
|
|
|
void InitializeOldNames();
|
2005-01-22 20:23:18 +00:00
|
|
|
|
2009-08-06 22:00:32 +00:00
|
|
|
void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings)
|
2004-08-09 17:04:08 +00:00
|
|
|
{
|
2009-01-23 23:40:12 +00:00
|
|
|
/* Make sure there isn't any window that can influence anything
|
|
|
|
* related to the new game we're about to start/load. */
|
|
|
|
UnInitWindowSystem();
|
|
|
|
|
2005-07-13 19:51:31 +00:00
|
|
|
AllocateMap(size_x, size_y);
|
|
|
|
|
2009-05-06 15:06:57 +00:00
|
|
|
_pause_mode = PM_UNPAUSED;
|
2004-08-09 17:04:08 +00:00
|
|
|
_fast_forward = 0;
|
|
|
|
_tick_counter = 0;
|
|
|
|
_cur_tileloop_tile = 0;
|
2009-01-19 15:06:11 +00:00
|
|
|
_thd.redsq = INVALID_TILE;
|
2009-08-06 22:00:32 +00:00
|
|
|
if (reset_settings) MakeNewgameSettingsLive();
|
2004-09-11 09:55:19 +00:00
|
|
|
|
2008-05-29 09:54:47 +00:00
|
|
|
if (reset_date) {
|
2010-08-22 09:18:01 +00:00
|
|
|
SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1), 0);
|
2008-05-04 22:19:44 +00:00
|
|
|
InitializeOldNames();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|
|
|
|
|
2010-08-22 09:18:01 +00:00
|
|
|
InitializeSound();
|
|
|
|
InitializeMusic();
|
|
|
|
|
2008-09-13 15:49:29 +00:00
|
|
|
InitializeEngineRenews();
|
2004-08-09 17:04:08 +00:00
|
|
|
InitializeVehicles();
|
2006-08-22 15:39:22 +00:00
|
|
|
InitializeDepots();
|
2005-01-15 19:06:22 +00:00
|
|
|
InitializeOrders();
|
2010-08-18 15:15:59 +00:00
|
|
|
InitializeOrderBackups();
|
2007-05-19 09:40:18 +00:00
|
|
|
InitializeGroup();
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
InitNewsItemStructs();
|
2005-07-13 19:51:31 +00:00
|
|
|
InitializeLandscape();
|
2004-08-09 17:04:08 +00:00
|
|
|
InitializeClearLand();
|
|
|
|
InitializeRailGui();
|
|
|
|
InitializeRoadGui();
|
|
|
|
InitializeAirportGui();
|
|
|
|
InitializeDockGui();
|
2010-03-11 21:55:37 +00:00
|
|
|
InitializeAIGui();
|
2004-08-09 17:04:08 +00:00
|
|
|
InitializeTowns();
|
2009-07-01 18:45:05 +00:00
|
|
|
InitializeSubsidies();
|
2004-08-09 17:04:08 +00:00
|
|
|
InitializeTrees();
|
2005-01-12 11:21:28 +00:00
|
|
|
InitializeSigns();
|
2004-08-09 17:04:08 +00:00
|
|
|
InitializeStations();
|
2009-06-23 21:44:48 +00:00
|
|
|
InitializeRoadStops();
|
2007-06-22 11:58:59 +00:00
|
|
|
InitializeCargoPackets();
|
2004-08-09 17:04:08 +00:00
|
|
|
InitializeIndustries();
|
2010-08-13 12:45:26 +00:00
|
|
|
InitializeObjects();
|
2007-03-19 11:27:30 +00:00
|
|
|
InitializeBuildingCounts();
|
2004-09-11 09:55:19 +00:00
|
|
|
|
2005-01-31 11:23:10 +00:00
|
|
|
InitializeNPF();
|
2004-08-09 17:04:08 +00:00
|
|
|
|
2008-09-30 20:39:50 +00:00
|
|
|
InitializeCompanies();
|
2009-01-12 17:11:45 +00:00
|
|
|
AI::Initialize();
|
2004-08-09 17:04:08 +00:00
|
|
|
InitializeCheats();
|
|
|
|
|
|
|
|
InitTextEffects();
|
2008-08-11 22:45:11 +00:00
|
|
|
#ifdef ENABLE_NETWORK
|
|
|
|
NetworkInitChatMessage();
|
|
|
|
#endif /* ENABLE_NETWORK */
|
2004-08-09 17:04:08 +00:00
|
|
|
InitializeAnimatedTiles();
|
|
|
|
|
2009-09-06 18:53:57 +00:00
|
|
|
InitializeEconomy();
|
2004-08-09 17:04:08 +00:00
|
|
|
|
|
|
|
ResetObjectToPlace();
|
2008-06-03 18:35:58 +00:00
|
|
|
|
|
|
|
GamelogReset();
|
|
|
|
GamelogStartAction(GLAT_START);
|
|
|
|
GamelogRevision();
|
|
|
|
GamelogMode();
|
|
|
|
GamelogGRFAddList(_grfconfig);
|
|
|
|
GamelogStopAction();
|
2004-08-09 17:04:08 +00:00
|
|
|
}
|