Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r--src/core/entity.cc29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index 9bc3f3c..e2aac1c 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -133,6 +133,12 @@ Entity::Entity(std::istream & is)
Entity::~Entity()
{
+ // delete entity menus
+ for (Menus::iterator it = menus().begin(); it != menus().end(); it++) {
+ delete (*it);
+ }
+ menus().clear();
+
if (entity_clientstate) {
delete entity_clientstate;
entity_clientstate = 0;
@@ -346,6 +352,29 @@ void Entity::frame(float seconds)
{
}
+void Entity::add_menu(MenuDescription *menu)
+{
+ entity_menus.push_back(menu);
+}
+
+MenuDescription *Entity::find_menu(std::string const &label)
+{
+ for (Menus::iterator it = menus().begin(); it != menus().end(); it++) {
+ if (label.compare((*it)->label()) == 0)
+ return (*it);
+ }
+ return 0;
+}
+
+void Entity::remove_menu(std::string const &label)
+{
+ for (Menus::iterator it = menus().begin(); it != menus().end(); it++) {
+ if (label.compare((*it)->label()) == 0)
+ menus().erase(it);
+ return;
+ }
+}
+
/* ---- class EntityDynamic ---------------------------------------- */
EntityDynamic::EntityDynamic(unsigned int flags) :