From d90c38ce59d406cdfd4303c836ee524a71ad0979 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 1 Sep 2023 22:36:26 +0200 Subject: rename character -> critter --- editor/app.cpp | 12 ++++++------ editor/app.hpp | 2 +- editor/draw.cpp | 2 +- editor/inspect-types.cpp | 21 +++++++++++---------- editor/update.cpp | 4 ++-- 5 files changed, 21 insertions(+), 20 deletions(-) (limited to 'editor') diff --git a/editor/app.cpp b/editor/app.cpp index 43e3116c..7f6f4171 100644 --- a/editor/app.cpp +++ b/editor/app.cpp @@ -6,7 +6,7 @@ #include "loader/loader.hpp" #include "world.hpp" #include "src/anim-atlas.hpp" -#include "src/character.hpp" +#include "src/critter.hpp" #include #include #include @@ -39,7 +39,7 @@ void app::reset_world() void app::ensure_player_character(world& w) { if (_character_id) - if (auto C = w.find_object(_character_id); C && C->type() == object_type::character) + if (auto C = w.find_object(_character_id); C && C->type() == object_type::critter) return; _character_id = 0; @@ -50,9 +50,9 @@ void app::ensure_player_character(world& w) for (const auto& e_ : c.objects()) { const auto& e = *e_; - if (e.type() == object_type::character) + if (e.type() == object_type::critter) { - const auto& C = static_cast(e); + const auto& C = static_cast(e); if (C.playable) id = std::min(id, C.id); } @@ -63,10 +63,10 @@ void app::ensure_player_character(world& w) _character_id = id; else { - character_proto cproto; + critter_proto cproto; cproto.name = "Player"_s; cproto.playable = true; - _character_id = w.make_object(w.make_id(), global_coords{}, cproto)->id; + _character_id = w.make_object(w.make_id(), global_coords{}, cproto)->id; } } diff --git a/editor/app.hpp b/editor/app.hpp index d3a02017..57849a08 100644 --- a/editor/app.hpp +++ b/editor/app.hpp @@ -24,7 +24,7 @@ struct tile_atlas; struct tile_editor; struct fm_settings; struct anim_atlas; -struct character; +struct critter; struct cursor_state final { Optional pixel; diff --git a/editor/draw.cpp b/editor/draw.cpp index bd0d863d..539b6c53 100644 --- a/editor/draw.cpp +++ b/editor/draw.cpp @@ -7,7 +7,7 @@ #include "draw/anim.hpp" #include "src/camera-offset.hpp" #include "src/world.hpp" -#include "character.hpp" +#include "src/critter.hpp" #include "rotation.inl" #include "src/RTree-search.hpp" diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp index 84fbbd5d..5996597f 100644 --- a/editor/inspect-types.cpp +++ b/editor/inspect-types.cpp @@ -6,7 +6,8 @@ #include "inspect.hpp" #include "loader/loader.hpp" #include "chunk.hpp" -#include "src/character.hpp" +#include "src/critter.hpp" + #include "src/light.hpp" #include #include @@ -95,7 +96,7 @@ template<> struct has_anim_atlas : std::true_type { static const anim_atlas& get_atlas(const object& x) { return *x.atlas; } }; template<> struct has_anim_atlas : has_anim_atlas {}; -template<> struct has_anim_atlas : has_anim_atlas {}; +template<> struct has_anim_atlas : has_anim_atlas {}; #endif using enum_pair = std::pair; @@ -174,18 +175,18 @@ static bool inspect_type(T& x, Intent) } template<> -struct entity_accessors { +struct entity_accessors { static constexpr auto accessors() { - using E = Entity; + using E = Entity; auto tuple0 = entity_accessors::accessors(); auto tuple = std::tuple{ E::type::field{"name"_s, - [](const character& x) { return x.name; }, - [](character& x, const String& value) { x.name = value; }}, + [](const critter& x) { return x.name; }, + [](critter& x, const String& value) { x.name = value; }}, E::type::field{"playable"_s, - [](const character& x) { return x.playable; }, - [](character& x, bool value) { x.playable = value; }, + [](const critter& x) { return x.playable; }, + [](critter& x, bool value) { x.playable = value; }, constantly(constraints::max_length{128}), }, }; @@ -235,7 +236,7 @@ struct entity_accessors //template bool inspect_type(object&); template bool inspect_type(scenery&, inspect_intent_t); -template bool inspect_type(character&, inspect_intent_t); +template bool inspect_type(critter&, inspect_intent_t); template bool inspect_type(light&, inspect_intent_t); bool inspect_object_subtype(object& x) @@ -245,7 +246,7 @@ bool inspect_object_subtype(object& x) default: fm_warn_once("unknown object subtype '%d'", (int)type); return false; //case object_type::none: return inspect_type(x); case object_type::scenery: return inspect_type(static_cast(x), inspect_intent_t{}); - case object_type::character: return inspect_type(static_cast(x), inspect_intent_t{}); + case object_type::critter: return inspect_type(static_cast(x), inspect_intent_t{}); case object_type::light: return inspect_type(static_cast(x), inspect_intent_t{}); } } diff --git a/editor/update.cpp b/editor/update.cpp index 4dacaf8a..aa1495c1 100644 --- a/editor/update.cpp +++ b/editor/update.cpp @@ -5,7 +5,7 @@ #include "main/clickable.hpp" #include "floormat/events.hpp" #include "floormat/main.hpp" -#include "src/character.hpp" +#include "src/critter.hpp" #include "src/tile-iterator.hpp" #include "keys.hpp" #include "loader/loader.hpp" @@ -234,7 +234,7 @@ void app::update_character([[maybe_unused]] float dt) if (_character_id) { auto& w = M->world(); - auto c = w.find_object(_character_id); + auto c = w.find_object(_character_id); if (c && c->playable) c->set_keys(keys[key_left], keys[key_right], keys[key_up], keys[key_down]); } -- cgit v1.2.3