Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-11-23 12:34:07 +0000
committerStijn Buys <ingar@osirion.org>2008-11-23 12:34:07 +0000
commit583ec3285c41e9d253c4aaabd2af4dadac75f3a7 (patch)
tree5ec345e44af9d3699a95f493d8358ee766e23330 /src/game/example
parent44158ccfbe943b832c0e0bf9ce547212aa6c2b8b (diff)
clean module consturction/destruction
Diffstat (limited to 'src/game/example')
-rw-r--r--src/game/example/example.cc26
-rw-r--r--src/game/example/example.h19
2 files changed, 18 insertions, 27 deletions
diff --git a/src/game/example/example.cc b/src/game/example/example.cc
index 9c3d55a..25daef7 100644
--- a/src/game/example/example.cc
+++ b/src/game/example/example.cc
@@ -10,15 +10,12 @@
namespace example {
-Example::Example() : core::Module("example", "The Osirion Project Example", true)
+core::Module *factory()
{
+ return new Example();
}
-Example::~Example()
-{
-}
-
-void Example::init()
+Example::Example() : core::Module("The Osirion Project Example", true)
{
/*
Initialize engine game variables
@@ -81,6 +78,14 @@ void Example::init()
}
+Example::~Example()
+{
+ /*
+ The world is automaticly deleted on shutdown,
+ but local variables have to be cleaned up
+ */
+ zone = 0;
+}
void Example::player_connect(core::Player *player)
{
@@ -113,13 +118,4 @@ void Example::frame(float elapsed)
}
-void Example::shutdown()
-{
- /*
- The world is automaticly deleted on shutdown,
- but local variables have to be cleaned up
- */
- zone = 0;
-}
-
}
diff --git a/src/game/example/example.h b/src/game/example/example.h
index ba8aa72..64e9e4d 100644
--- a/src/game/example/example.h
+++ b/src/game/example/example.h
@@ -34,31 +34,26 @@ public:
Example();
/// desctructor, called on module unload
- ~Example();
+ virtual ~Example();
/// called once every server frame
/** @param elapsed time elapsed since the precious server frame, in seconds
*/
- void frame(float elapsed);
+ virtual void frame(float elapsed);
/// called when a player connects
- void player_connect(core::Player *player);
+ virtual void player_connect(core::Player *player);
/// called when a player disconnects
- void player_disconnect(core::Player *player);
-
-protected:
- /// called when the game starts
- void init();
-
- /// called when the game is shut down
- void shutdown();
-
+ virtual void player_disconnect(core::Player *player);
private:
core::Zone *zone;
};
+/// factory function
+core::Module *factory();
+
}
#endif // __INCLUDED_EXAMPLE_H__