- Ara es poden reordenar els templates i les categories

This commit is contained in:
2024-09-20 09:21:26 +02:00
parent 16914932ec
commit 81b9791144
3 changed files with 59 additions and 1 deletions

View File

@@ -1446,6 +1446,7 @@ namespace actor
dest->react_mask = source->react_mask;
dest->react_push = source->react_push;
dest->movement = source->movement;
dest->template_category = source->template_category;
}
void add(actor_t *act)
@@ -1470,6 +1471,35 @@ namespace actor
}
save();
}
void swapCategories(const int a, const int b)
{
if (a >= categories.size() || a < 0) return;
if (b >= categories.size() || b < 0) return;
auto str = categories[a];
categories[a] = categories[b];
categories[b] = str;
for (auto &actor : templates)
{
if (actor.template_category == a) actor.template_category = b;
else if (actor.template_category == b) actor.template_category = a;
}
/*
auto old_categories = categories;
categories.clear();
std::string relocated = "";
for (int i=0; i<old_categories.size(); ++i)
{
if (i==index) {
relocated = old_categories[i];
} else {
categories.push_back(old_categories[i]);
if (relocated != "") { categories.push_back(relocated); relocated = ""; }
}
}
*/
}
}
namespace hero