1
This commit is contained in:
parent
0ab3a0a8a4
commit
f30d8cffb1
@ -3094,22 +3094,26 @@ Obstacle* Creature::SummonObstacle(Buff* buff,
|
||||
|
||||
void Creature::RemoveSurplusObstacle(int id, int num)
|
||||
{
|
||||
#if 0
|
||||
if (slave_things_.size() >= num && num > 0) {
|
||||
std::vector<RoomObstacleWeakPtr> matched_things;
|
||||
for (auto& itr : slave_things_) {
|
||||
if (std::get<0>(itr) == buff_id &&
|
||||
std::get<1>(itr).Get() &&
|
||||
std::get<1>(itr).Get()->meta->thing_id() == id) {
|
||||
matched_things.push_back(std::get<1>(itr));
|
||||
auto itr = slave_things2_.find(id);
|
||||
if (itr != slave_things2_.end() && num >= 0) {
|
||||
int exists_num = 0;
|
||||
{
|
||||
list_head* pos = nullptr;
|
||||
list_head* next = nullptr;
|
||||
list_head* head = &itr->second;
|
||||
list_for_each_safe(pos, next, head) {
|
||||
++exists_num;
|
||||
}
|
||||
}
|
||||
while (matched_things.size() > num) {
|
||||
matched_things[0].Get()->Destory();
|
||||
matched_things.erase(matched_things.begin());
|
||||
while (exists_num > num) {
|
||||
RoomObstacle* ob = list_first_entry(&itr->second,
|
||||
RoomObstacle,
|
||||
entry);
|
||||
ob->Destory();
|
||||
list_del_init(&ob->entry);
|
||||
--exists_num;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
Obstacle* Creature::InternalSummonObstacle(Buff* buff, const mt::MapThing* thing_meta,
|
||||
|
Loading…
x
Reference in New Issue
Block a user