projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
you can compare colors now
[supertux.git]
/
src
/
game_object.hpp
diff --git
a/src/game_object.hpp
b/src/game_object.hpp
index
7d4b05f
..
5acc833
100644
(file)
--- a/
src/game_object.hpp
+++ b/
src/game_object.hpp
@@
-34,7
+34,6
@@
class ObjectRemoveListener;
* draw() functions. Both are called once per frame.
* - Providing a safe way to remove the object by calling the remove_me
* functions.
* draw() functions. Both are called once per frame.
* - Providing a safe way to remove the object by calling the remove_me
* functions.
- * - a 32bit bitset for flags...
*/
class GameObject : public RefCounter
{
*/
class GameObject : public RefCounter
{
@@
-59,36
+58,27
@@
public:
{
return !wants_to_die;
}
{
return !wants_to_die;
}
-
+
/** schedules this object to be removed at the end of the frame */
void remove_me()
{
wants_to_die = true;
}
/** schedules this object to be removed at the end of the frame */
void remove_me()
{
wants_to_die = true;
}
-
- /** registers a remove listener which will be called if the object
+
+ /** registers a remove listener which will be called if the object
* gets removed/destroyed
*/
* gets removed/destroyed
*/
- void add_remove_listener(ObjectRemoveListener* listener)
- {
- RemoveListenerListEntry* entry = new RemoveListenerListEntry();
- entry->next = remove_listeners;
- entry->listener = listener;
-
- remove_listeners = entry;
- }
+ void add_remove_listener(ObjectRemoveListener* listener);
- // flags
- enum {
- /// the tile so you can stand on it
- FLAG_SOLID = (1 << 0),
- /// the object can be carried around (inherits from Portable)
- FLAG_PORTABLE = (1 << 1)
- };
+ /**
+ * unregisters a remove listener, so it will no longer be called if the object
+ * gets removed/destroyed
+ */
+ void del_remove_listener(ObjectRemoveListener* listener);
-
int get_flags
() const
+
const std::string& get_name
() const
{
{
- return
flags;
+ return
name;
}
private:
}
private:
@@
-105,8
+95,11
@@
private:
RemoveListenerListEntry* remove_listeners;
protected:
RemoveListenerListEntry* remove_listeners;
protected:
- int flags;
+ /**
+ * a name for the gameobject, this is mostly a hint for scripts and for
+ * debugging, don't rely on names being set or being unique
+ */
+ std::string name;
};
#endif /*SUPERTUX_GAMEOBJECT_H*/
};
#endif /*SUPERTUX_GAMEOBJECT_H*/
-