diff options
author | Stijn Buys <ingar@osirion.org> | 2008-11-09 11:43:28 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-11-09 11:43:28 +0000 |
commit | 9d39702824e8fae5127e09fb5a05b521b48cd028 (patch) | |
tree | a56fdfc6e85a2405461be22bc80e43b33c8b8b48 /src/core/entity.cc | |
parent | 6cd1a38f1d3a0a45846d63a75475400372af1277 (diff) |
docking menus
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r-- | src/core/entity.cc | 29 |
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) : |