From 5a503d505b8e1df6dea8ad78da6003c269ec397c Mon Sep 17 00:00:00 2001 From: rubidium Date: Thu, 18 Nov 2010 14:01:20 +0000 Subject: [PATCH] (svn r21231) -Codechange: Generalize the naming of some settings and variables related to visual effects (Hirundo) --- src/lang/english.txt | 2 +- src/newgrf_callbacks.h | 6 +++--- src/newgrf_sound.h | 19 ++++++++++--------- src/settings_gui.cpp | 2 +- src/table/newgrf_debug_data.h | 2 +- src/train_cmd.cpp | 6 +++--- 6 files changed, 19 insertions(+), 18 deletions(-) diff --git a/src/lang/english.txt b/src/lang/english.txt index f79b192a3e..ca26d695c1 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -1090,7 +1090,7 @@ STR_CONFIG_SETTING_AUTOSLOPE :{LTBLUE}Allow t STR_CONFIG_SETTING_CATCHMENT :{LTBLUE}Allow more realistically sized catchment areas: {ORANGE}{STRING1} STR_CONFIG_SETTING_EXTRADYNAMITE :{LTBLUE}Allow removal of more town-owned roads, bridges, etc: {ORANGE}{STRING1} STR_CONFIG_SETTING_MAMMOTHTRAINS :{LTBLUE}Enable building very long trains: {ORANGE}{STRING1} -STR_CONFIG_SETTING_SMOKE_AMOUNT :{LTBLUE}Amount of locomotive smoke/sparks: {ORANGE}{STRING1} +STR_CONFIG_SETTING_SMOKE_AMOUNT :{LTBLUE}Amount of vehicle smoke/sparks: {ORANGE}{STRING1} STR_CONFIG_SETTING_SMOKE_AMOUNT_NONE :None STR_CONFIG_SETTING_SMOKE_AMOUNT_ORIGINAL :Original STR_CONFIG_SETTING_SMOKE_AMOUNT_REALISTIC :Realistic diff --git a/src/newgrf_callbacks.h b/src/newgrf_callbacks.h index 8cc5f9359e..22daba5983 100644 --- a/src/newgrf_callbacks.h +++ b/src/newgrf_callbacks.h @@ -28,8 +28,8 @@ enum CallbackID { /* There are no callbacks 0x02 - 0x0F. */ - /** Powered wagons and visual effects. */ - CBID_TRAIN_WAGON_POWER = 0x10, // 8 bit callback + /** Visual effects and wagon power. */ + CBID_VEHICLE_VISUAL_EFFECT = 0x10, // 8 bit callback /** Vehicle length, returns the amount of 1/8's the vehicle is shorter for trains and RVs. */ CBID_VEHICLE_LENGTH = 0x11, @@ -279,7 +279,7 @@ enum CallbackID { * Some callbacks are always used and don't have a mask. */ enum VehicleCallbackMask { - CBM_TRAIN_WAGON_POWER = 0, ///< Powered wagons (trains only) + CBM_VEHICLE_VISUAL_EFFECT = 0, ///< Visual effects and wagon power (trains only) CBM_VEHICLE_LENGTH = 1, ///< Vehicle length (trains and road vehicles) CBM_VEHICLE_LOAD_AMOUNT = 2, ///< Load amount CBM_VEHICLE_REFIT_CAPACITY = 3, ///< Cargo capacity after refit diff --git a/src/newgrf_sound.h b/src/newgrf_sound.h index e25ca5055c..0219951ed5 100644 --- a/src/newgrf_sound.h +++ b/src/newgrf_sound.h @@ -16,16 +16,17 @@ #include "tile_type.h" #include "vehicle_type.h" +/** Events at which a sound might be played. */ enum VehicleSoundEvent { - VSE_START = 1, - VSE_TUNNEL = 2, - VSE_BREAKDOWN = 3, - VSE_RUNNING = 4, - VSE_TOUCHDOWN = 5, - VSE_TRAIN_EFFECT = 6, - VSE_RUNNING_16 = 7, - VSE_STOPPED_16 = 8, - VSE_LOAD_UNLOAD = 9, + VSE_START = 1, ///< Vehicle starting, i.e. leaving, the station. + VSE_TUNNEL = 2, ///< Train entering a tunnel. + VSE_BREAKDOWN = 3, ///< Vehicle breaking down. + VSE_RUNNING = 4, ///< Vehicle running normally. + VSE_TOUCHDOWN = 5, ///< Whenever a plane touches down. + VSE_VISUAL_EFFECT = 6, ///< Vehicle visual effect (steam, diesel smoke or electric spark) is shown. + VSE_RUNNING_16 = 7, ///< Every 16 ticks while the vehicle is running (speed > 0). + VSE_STOPPED_16 = 8, ///< Every 16 ticks while the vehicle is stopped (speed == 0). + VSE_LOAD_UNLOAD = 9, ///< Whenever cargo payment is made for a vehicle. }; diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 93f8e38165..8d58d52463 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -1448,7 +1448,6 @@ static SettingEntry _settings_vehicles_trains[] = { SettingEntry("vehicle.train_acceleration_model"), SettingEntry("vehicle.train_slope_steepness"), SettingEntry("vehicle.mammoth_trains"), - SettingEntry("vehicle.smoke_amount"), SettingEntry("gui.lost_train_warn"), SettingEntry("vehicle.wagon_speed_limits"), SettingEntry("vehicle.disable_elrails"), @@ -1478,6 +1477,7 @@ static SettingEntry _settings_vehicles[] = { SettingEntry("vehicle.dynamic_engines"), SettingEntry("vehicle.roadveh_acceleration_model"), SettingEntry("vehicle.roadveh_slope_steepness"), + SettingEntry("vehicle.smoke_amount"), }; /** Vehicles sub-page */ static SettingsPage _settings_vehicles_page = {_settings_vehicles, lengthof(_settings_vehicles)}; diff --git a/src/table/newgrf_debug_data.h b/src/table/newgrf_debug_data.h index 0af8ebf714..07b759ebaa 100644 --- a/src/table/newgrf_debug_data.h +++ b/src/table/newgrf_debug_data.h @@ -26,7 +26,7 @@ #define NICV(cb_id, bit) NIC(cb_id, Engine, info.callback_mask, bit) static const NICallback _nic_vehicles[] = { - NICV(CBID_TRAIN_WAGON_POWER, CBM_TRAIN_WAGON_POWER), + NICV(CBID_VEHICLE_VISUAL_EFFECT, CBM_VEHICLE_VISUAL_EFFECT), NICV(CBID_VEHICLE_LENGTH, CBM_VEHICLE_LENGTH), NICV(CBID_VEHICLE_LOAD_AMOUNT, CBM_VEHICLE_LOAD_AMOUNT), NICV(CBID_VEHICLE_REFIT_CAPACITY, CBM_VEHICLE_REFIT_CAPACITY), diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index a207697112..4966c40f61 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -163,8 +163,8 @@ void Train::UpdateVisualEffect(bool allow_power_change) } /* Check powered wagon / visual effect callback */ - if (HasBit(e->info.callback_mask, CBM_TRAIN_WAGON_POWER)) { - uint16 callback = GetVehicleCallback(CBID_TRAIN_WAGON_POWER, 0, 0, this->engine_type, this); + if (HasBit(e->info.callback_mask, CBM_VEHICLE_VISUAL_EFFECT)) { + uint16 callback = GetVehicleCallback(CBID_VEHICLE_VISUAL_EFFECT, 0, 0, this->engine_type, this); if (callback != CALLBACK_FAILED) this->tcache.cached_vis_effect = GB(callback, 0, 8); } @@ -2032,7 +2032,7 @@ static void HandleLocomotiveSmokeCloud(const Train *v) } } while ((v = v->Next()) != NULL); - if (sound) PlayVehicleSound(u, VSE_TRAIN_EFFECT); + if (sound) PlayVehicleSound(u, VSE_VISUAL_EFFECT); } void Train::PlayLeaveStationSound() const