From 698d845a7ef3509c3a2b6337a05a641a7eef9cb8 Mon Sep 17 00:00:00 2001 From: Fris0uman Date: Sun, 30 Jun 2024 12:12:24 +0200 Subject: [PATCH] rename death_screen to end_screen --- src/death_screen.cpp | 38 ---------------------------- src/end_screen.cpp | 38 ++++++++++++++++++++++++++++ src/{death_screen.h => end_screen.h} | 8 +++--- src/init.cpp | 4 +-- src/type_id.h | 6 ++--- 5 files changed, 47 insertions(+), 47 deletions(-) delete mode 100644 src/death_screen.cpp create mode 100644 src/end_screen.cpp rename src/{death_screen.h => end_screen.h} (69%) diff --git a/src/death_screen.cpp b/src/death_screen.cpp deleted file mode 100644 index 84b238b1b28f1..0000000000000 --- a/src/death_screen.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "assign.h" -#include "condition.h" -#include "death_screen.h" -#include "generic_factory.h" - -namespace -{ -generic_factory death_screen_factory( "death_screen" ); -} // namespace - -template<> -const death_screen &string_id::obj()const -{ - return death_screen_factory.obj( *this ); -} - -template<> -bool string_id::is_valid() const -{ - return death_screen_factory.is_valid( *this ); -} - -void death_screen::load_death_screen( const JsonObject &jo, const std::string &src ) -{ - death_screen_factory.load( jo, src ); -} - -void death_screen::load( const JsonObject &jo, std::string_view ) -{ - mandatory( jo, was_loaded, "id", id ); - mandatory( jo, was_loaded, "picture_id", picture_id ); - read_condition( jo, "condition", condition, false ); -} - -const std::vector &death_screen::get_all() -{ - return death_screen_factory.get_all(); -} diff --git a/src/end_screen.cpp b/src/end_screen.cpp new file mode 100644 index 0000000000000..5107d4d2ea8b4 --- /dev/null +++ b/src/end_screen.cpp @@ -0,0 +1,38 @@ +#include "assign.h" +#include "condition.h" +#include "end_screen.h" +#include "generic_factory.h" + +namespace +{ +generic_factory end_screen_factory( "end_screen" ); +} // namespace + +template<> +const end_screen &string_id::obj()const +{ + return end_screen_factory.obj( *this ); +} + +template<> +bool string_id::is_valid() const +{ + return end_screen_factory.is_valid( *this ); +} + +void end_screen::load_end_screen( const JsonObject &jo, const std::string &src ) +{ + end_screen_factory.load( jo, src ); +} + +void end_screen::load( const JsonObject &jo, std::string_view ) +{ + mandatory( jo, was_loaded, "id", id ); + mandatory( jo, was_loaded, "picture_id", picture_id ); + read_condition( jo, "condition", condition, false ); +} + +const std::vector &end_screen::get_all() +{ + return end_screen_factory.get_all(); +} diff --git a/src/death_screen.h b/src/end_screen.h similarity index 69% rename from src/death_screen.h rename to src/end_screen.h index 1224807c5cec9..34d9e40e6aada 100644 --- a/src/death_screen.h +++ b/src/end_screen.h @@ -11,16 +11,16 @@ class JsonObject; -class death_screen +class end_screen { public: - static void load_death_screen( const JsonObject &jo, const std::string &src ); + static void load_end_screen( const JsonObject &jo, const std::string &src ); void load( const JsonObject &jo, std::string_view ); - static const std::vector& get_all(); + static const std::vector &get_all(); bool was_loaded = false; - death_screen_id id; + end_screen_id id; ascii_art_id picture_id; std::function condition; }; diff --git a/src/init.cpp b/src/init.cpp index cf929b36a495b..e13963ea6c0af 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -31,13 +31,13 @@ #include "construction_group.h" #include "crafting_gui.h" #include "creature.h" -#include "death_screen.h" #include "debug.h" #include "dialogue.h" #include "disease.h" #include "effect.h" #include "effect_on_condition.h" #include "emit.h" +#include "end_screen.h" #include "event_statistics.h" #include "faction.h" #include "fault.h" @@ -299,7 +299,7 @@ void DynamicDataLoader::initialize() add( "scent_type", &scent_type::load_scent_type ); add( "disease_type", &disease_type::load_disease_type ); add( "ascii_art", &ascii_art::load_ascii_art ); - add( "death_screen", &death_screen::load_death_screen ); + add( "end_screen", &end_screen::load_end_screen ); // json/colors.json would be listed here, but it's loaded before the others (see init_colors()) // Non Static Function Access diff --git a/src/type_id.h b/src/type_id.h index 7fccb23d1a281..d3164eee1d3b6 100644 --- a/src/type_id.h +++ b/src/type_id.h @@ -79,9 +79,6 @@ using damage_type_id = string_id; struct damage_info_order; using damage_info_order_id = string_id; -struct death_screen; -using death_screen_id = string_id; - class disease_type; using diseasetype_id = string_id; @@ -91,6 +88,9 @@ using emit_id = string_id; class enchantment; using enchantment_id = string_id; +struct end_screen; +using end_screen_id = string_id; + class event_statistic; using event_statistic_id = string_id;