Skip to content

Commit

Permalink
support custom types in kill_recursive and destroy_recursive
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Auto committed Oct 8, 2023
1 parent 4f5649f commit 099d40b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/game_api/entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "entities_chars.hpp" // for Player
#include "entities_monsters.hpp" //
#include "entity_hooks_info.hpp" // for EntityHooksInfo
#include "entity_lookup.hpp" //
#include "memory.hpp" // for write_mem_prot
#include "movable.hpp" // for Movable
#include "movable_behavior.hpp" // for MovableBehavior
Expand Down Expand Up @@ -542,7 +543,7 @@ void Entity::kill_recursive(bool destroy_corpse, Entity* responsible, std::optio
{
ent->kill(destroy_corpse, responsible);
};
if (!recursive(this, mask, ent_types, rec_mode, kill_func))
if (!recursive(this, mask, get_proper_types(ent_types), rec_mode, kill_func))
kill(destroy_corpse, responsible);
}

Expand All @@ -552,6 +553,6 @@ void Entity::destroy_recursive(std::optional<uint32_t> mask, const std::vector<E
{
ent->destroy();
};
if (!recursive(this, mask, ent_types, rec_mode, destroy_func))
if (!recursive(this, mask, get_proper_types(ent_types), rec_mode, destroy_func))
destroy();
}
1 change: 1 addition & 0 deletions src/game_api/entity_lookup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ std::vector<uint32_t> entity_get_items_by(uint32_t uid, std::vector<ENT_TYPE> en
std::vector<uint32_t> entity_get_items_by(uint32_t uid, ENT_TYPE entity_type, uint32_t mask);
std::vector<uint32_t> get_entities_by_draw_depth(uint8_t draw_depth, LAYER l);
std::vector<uint32_t> get_entities_by_draw_depth(std::vector<uint8_t> draw_depths, LAYER l);
std::vector<ENT_TYPE> get_proper_types(std::vector<ENT_TYPE> ent_types);

0 comments on commit 099d40b

Please sign in to comment.