X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Fworld%2Fworld.cpp;h=033967ad970ffecd32c098f226c1942b8b97dabd;hb=cdd865c1934eccbb1f1d0ffaf041e53f0fdd524b;hp=2292d15418f6dd30420bb329b9f09fb2fcb2c8f4;hpb=b00e4b77859d13bdf29bd50e91315a46a15bd01d;p=blank.git diff --git a/src/world/world.cpp b/src/world/world.cpp index 2292d15..033967a 100644 --- a/src/world/world.cpp +++ b/src/world/world.cpp @@ -764,6 +764,26 @@ Entity &World::ForceAddEntity(std::uint32_t id) { } +Player *World::FindPlayer(const std::string &name) { + for (Player &p : players) { + if (p.Name() == name) { + return &p; + } + } + return nullptr; +} + +Entity *World::FindEntity(const std::string &name) { + // TODO: this may get inefficient + for (Entity &e : entities) { + if (e.Name() == name) { + return &e; + } + } + return nullptr; +} + + namespace { struct Candidate {