From 7f7efd3cd73bffa081d704ad61321955dbfd701c Mon Sep 17 00:00:00 2001 From: J. Tang Date: Thu, 2 Dec 2010 00:09:02 -0500 Subject: [PATCH 3/6] Use functions in the new DisasterTimer class instead of global functions. Also use disaster.h instead of extern declarations. Signed-off-by: J. Tang --- src/date.cpp | 4 ++-- src/genworld.cpp | 4 ++-- src/industry.h | 2 -- src/industry_cmd.cpp | 1 + src/openttd.cpp | 5 ++--- src/vehicle.cpp | 1 + src/vehicle_func.h | 2 -- 7 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/date.cpp b/src/date.cpp index 4ef16ae..5267f1e 100644 --- a/src/date.cpp +++ b/src/date.cpp @@ -18,6 +18,7 @@ #include "date_func.h" #include "vehicle_base.h" #include "rail_gui.h" +#include "disaster.h" #include "saveload/saveload.h" Year _cur_year; ///< Current year, starting at 0 @@ -157,7 +158,6 @@ Date ConvertYMDToDate(Year year, Month month, Day day) /** Functions used by the IncreaseDate function */ extern void EnginesDailyLoop(); -extern void DisasterDailyLoop(); extern void IndustryDailyLoop(); extern void CompaniesMonthlyLoop(); @@ -253,7 +253,7 @@ static void OnNewDay() if (_network_server) NetworkServerDailyLoop(); #endif /* ENABLE_NETWORK */ - DisasterDailyLoop(); + DisasterTimer::DailyLoop(); IndustryDailyLoop(); SetWindowWidgetDirty(WC_STATUS_BAR, 0, 0); diff --git a/src/genworld.cpp b/src/genworld.cpp index af42a5b..97bd851 100644 --- a/src/genworld.cpp +++ b/src/genworld.cpp @@ -31,6 +31,7 @@ #include "void_map.h" #include "town.h" #include "newgrf.h" +#include "disaster.h" #include "core/random_func.hpp" #include "core/backup_type.hpp" @@ -43,7 +44,6 @@ void GenerateTrees(); void StartupEconomy(); void StartupCompanies(); -void StartupDisasters(); void InitializeGame(uint size_x, uint size_y, bool reset_date, bool reset_settings); @@ -154,7 +154,7 @@ static void _GenerateWorld(void *) IncreaseGeneratingWorldProgress(GWP_GAME_INIT); StartupEngines(); IncreaseGeneratingWorldProgress(GWP_GAME_INIT); - StartupDisasters(); + DisasterTimer::Startup(); _generating_world = false; /* No need to run the tile loop in the scenario editor. */ diff --git a/src/industry.h b/src/industry.h index 18a20a7..dfadf69 100644 --- a/src/industry.h +++ b/src/industry.h @@ -138,8 +138,6 @@ protected: void PlantRandomFarmField(const Industry *i); -void ReleaseDisastersTargetingIndustry(IndustryID); - #define FOR_ALL_INDUSTRIES_FROM(var, start) FOR_ALL_ITEMS_FROM(Industry, industry_index, var, start) #define FOR_ALL_INDUSTRIES(var) FOR_ALL_INDUSTRIES_FROM(var, 0) diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index 1056f23..8c89a39 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -41,6 +41,7 @@ #include "subsidy_func.h" #include "core/backup_type.hpp" #include "object_base.h" +#include "disaster.h" #include "table/strings.h" #include "table/industry_land.h" diff --git a/src/openttd.cpp b/src/openttd.cpp index 8c938f1..1a7ac76 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -61,7 +61,7 @@ #include "core/backup_type.hpp" #include "hotkeys.h" #include "newgrf.h" - +#include "disaster.h" #include "town.h" #include "industry.h" @@ -859,7 +859,6 @@ static void MakeNewEditorWorld() } void StartupCompanies(); -void StartupDisasters(); extern void StartupEconomy(); /** @@ -950,7 +949,7 @@ static void StartScenario() StartupEconomy(); StartupCompanies(); StartupEngines(); - StartupDisasters(); + DisasterTimer::Startup(); SetLocalCompany(COMPANY_FIRST); Company *c = Company::Get(COMPANY_FIRST); diff --git a/src/vehicle.cpp b/src/vehicle.cpp index ff6039c..fa066d6 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -52,6 +52,7 @@ #include "vehiclelist.h" #include "tunnel_map.h" #include "depot_map.h" +#include "disaster.h" #include "table/strings.h" diff --git a/src/vehicle_func.h b/src/vehicle_func.h index d7752cf..1809250 100644 --- a/src/vehicle_func.h +++ b/src/vehicle_func.h @@ -181,6 +181,4 @@ extern byte _age_cargo_skip_counter; bool CanVehicleUseStation(EngineID engine_type, const struct Station *st); bool CanVehicleUseStation(const Vehicle *v, const struct Station *st); -void ReleaseDisastersTargetingVehicle(VehicleID vehicle); - #endif /* VEHICLE_FUNC_H */ -- 1.7.3.2