diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-01 22:36:26 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2023-09-01 22:36:26 +0200 |
commit | d90c38ce59d406cdfd4303c836ee524a71ad0979 (patch) | |
tree | 27c7bae59fbea84529977f588f050d5ce09e14ea /editor | |
parent | 31fd5bbc08234686cf798a93a18e0bb73615d1bf (diff) |
rename character -> critter
Diffstat (limited to 'editor')
-rw-r--r-- | editor/app.cpp | 12 | ||||
-rw-r--r-- | editor/app.hpp | 2 | ||||
-rw-r--r-- | editor/draw.cpp | 2 | ||||
-rw-r--r-- | editor/inspect-types.cpp | 21 | ||||
-rw-r--r-- | editor/update.cpp | 4 |
5 files changed, 21 insertions, 20 deletions
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 <cerrno> #include <cstdlib> #include <cstring> @@ -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<const character&>(e); + const auto& C = static_cast<const critter&>(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<character>(w.make_id(), global_coords{}, cproto)->id; + _character_id = w.make_object<critter>(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<Vector2i> 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 <Corrade/Containers/ArrayViewStl.h> #include <imgui.h> @@ -95,7 +96,7 @@ template<> struct has_anim_atlas<object> : std::true_type { static const anim_atlas& get_atlas(const object& x) { return *x.atlas; } }; template<> struct has_anim_atlas<scenery> : has_anim_atlas<object> {}; -template<> struct has_anim_atlas<character> : has_anim_atlas<object> {}; +template<> struct has_anim_atlas<critter> : has_anim_atlas<object> {}; #endif using enum_pair = std::pair<StringView, size_t>; @@ -174,18 +175,18 @@ static bool inspect_type(T& x, Intent) } template<> -struct entity_accessors<character, inspect_intent_t> { +struct entity_accessors<critter, inspect_intent_t> { static constexpr auto accessors() { - using E = Entity<character>; + using E = Entity<critter>; auto tuple0 = entity_accessors<object, inspect_intent_t>::accessors(); auto tuple = std::tuple{ E::type<String>::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<bool>::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<light, inspect_intent_t> //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<scenery&>(x), inspect_intent_t{}); - case object_type::character: return inspect_type(static_cast<character&>(x), inspect_intent_t{}); + case object_type::critter: return inspect_type(static_cast<critter&>(x), inspect_intent_t{}); case object_type::light: return inspect_type(static_cast<light&>(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>(_character_id); + auto c = w.find_object<critter>(_character_id); if (c && c->playable) c->set_keys(keys[key_left], keys[key_right], keys[key_up], keys[key_down]); } |