From f990980f80ab1523086edba1bed222741d716fa0 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Fri, 10 Aug 2007 14:17:38 +0000 Subject: Improved helper functions for Lua scripts. Associated scripts to maps. --- src/game-server/mapcomposite.hpp | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'src/game-server/mapcomposite.hpp') diff --git a/src/game-server/mapcomposite.hpp b/src/game-server/mapcomposite.hpp index 00d52173..fb86ee85 100644 --- a/src/game-server/mapcomposite.hpp +++ b/src/game-server/mapcomposite.hpp @@ -34,6 +34,7 @@ class Object; class Character; class Point; class Rectangle; +class Script; class Thing; struct MapContent; @@ -129,8 +130,7 @@ class MapComposite /** * Constructor. */ - MapComposite(int id, std::string const &name) - : mMap(NULL), mContent(NULL), mName(name), mID(id) {} + MapComposite(int id, std::string const &name); /** * Destructor. @@ -149,6 +149,18 @@ class MapComposite Map *getMap() const { return mMap; } + /** + * Sets the associated script. + */ + void setScript(Script *s) + { mScript = s; } + + /** + * Gets the associated script. + */ + Script *getScript() const + { return mScript; } + /** * Returns whether the map is active on this server or not. */ @@ -217,10 +229,11 @@ class MapComposite private: MapComposite(MapComposite const &); - Map *mMap; /**< Actual map. */ + Map *mMap; /**< Actual map. */ MapContent *mContent; /**< Entities on the map. */ - std::string mName; /**< Name of the map. */ - unsigned short mID; /**< ID of the map. */ + Script *mScript; /**< Script associated to this map. */ + std::string mName; /**< Name of the map. */ + unsigned short mID; /**< ID of the map. */ }; #endif -- cgit v1.2.3-60-g2f50