diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-10-23 20:31:43 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-10-23 20:31:43 +0000 |
commit | f689c19d25b634a1883f402eff6a07d73fa5da21 (patch) | |
tree | 9707ecf47b75db1c5c2aa4fcea0246c27275951a /src | |
parent | 0c3a3264db6b746c64a3f3145b73c0e5a846e7fc (diff) | |
download | manaserv-f689c19d25b634a1883f402eff6a07d73fa5da21.tar.gz manaserv-f689c19d25b634a1883f402eff6a07d73fa5da21.tar.xz manaserv-f689c19d25b634a1883f402eff6a07d73fa5da21.zip |
Fixed compiler warnings, including a forgotten initialization of an item's
script pointer.
Diffstat (limited to 'src')
-rw-r--r-- | src/game-server/item.hpp | 30 | ||||
-rw-r--r-- | src/game-server/itemmanager.cpp | 8 | ||||
-rw-r--r-- | src/utils/string.cpp | 12 | ||||
-rw-r--r-- | src/utils/string.hpp | 3 |
4 files changed, 27 insertions, 26 deletions
diff --git a/src/game-server/item.hpp b/src/game-server/item.hpp index 3878755..603dc2f 100644 --- a/src/game-server/item.hpp +++ b/src/game-server/item.hpp @@ -27,11 +27,10 @@ #include <vector> #include "game-server/object.hpp" -#include "scripting/script.hpp" - class AttackZone; class Being; +class Script; /** * Enumeration of available Item types. @@ -178,7 +177,7 @@ class ItemClass { public: ItemClass(int id, ItemType type, Script *s = NULL) - : mDatabaseID(id), mType(type), mAttackZone(NULL), mScript(NULL) + : mScript(NULL), mDatabaseID(id), mType(type), mAttackZone(NULL) {} ~ItemClass(); @@ -280,21 +279,22 @@ class ItemClass private: - //Script for using items - Script *mScript; - - // Item reference information - unsigned short mDatabaseID; - unsigned short mSpriteID; /**< The sprite that should be shown to the character */ - ItemType mType; /**< Type: usable, equipment etc. */ - unsigned short mWeight; /**< Weight of the item. */ - unsigned short mCost; /**< Unit cost the item. */ - unsigned short mMaxPerSlot; /**< Max item amount per slot in inventory. */ + Script *mScript; /**< Script for using items */ + + unsigned short mDatabaseID; /**< Item reference information */ + /** The sprite that should be shown to the character */ + unsigned short mSpriteID; + ItemType mType; /**< Type: usable, equipment etc. */ + unsigned short mWeight; /**< Weight of the item. */ + unsigned short mCost; /**< Unit cost the item. */ + /** Max item amount per slot in inventory. */ + unsigned short mMaxPerSlot; + ItemModifiers mModifiers; /**< Item modifiers. */ - AttackZone *mAttackZone; /**< attack zone when used as a weapon */ + AttackZone *mAttackZone; /**< Attack zone when used as a weapon */ }; -class Item: public Object +class Item : public Object { public: Item(ItemClass *type, int amount) diff --git a/src/game-server/itemmanager.cpp b/src/game-server/itemmanager.cpp index 6541901..019f4c9 100644 --- a/src/game-server/itemmanager.cpp +++ b/src/game-server/itemmanager.cpp @@ -30,6 +30,7 @@ #include "game-server/attackzone.hpp" #include "game-server/item.hpp" #include "game-server/resourcemanager.hpp" +#include "scripting/script.hpp" #include "utils/logger.h" #include "utils/xml.hpp" @@ -181,19 +182,18 @@ void ItemManager::reload() weight = 1; } - Script *s; - //TODO: Clean this up some + // TODO: Clean this up some + Script *s = 0; std::stringstream filename; filename << "scripts/items/" << id << ".lua"; - if(ResourceManager::exists(filename.str())) //file exists! + if (ResourceManager::exists(filename.str())) // file exists! { LOG_INFO("Loading item script: " + filename.str()); s = Script::create("lua"); s->loadFile(filename.str()); } - item->setWeight(weight); item->setCost(value); item->setMaxPerSlot(maxPerSlot); diff --git a/src/utils/string.cpp b/src/utils/string.cpp index 04d5f03..0785429 100644 --- a/src/utils/string.cpp +++ b/src/utils/string.cpp @@ -18,14 +18,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ -#include <string> -#include <cctype> + #include "utils/string.hpp" +#include <cctype> +#include <algorithm> + std::string utils::toupper(std::string s) { - for (int j=0; j<s.length(); ++j) - s[j]=std::toupper(s[j]); + std::transform(s.begin(), s.end(), s.begin(), (int(*)(int)) toupper); return s; -} - +} diff --git a/src/utils/string.hpp b/src/utils/string.hpp index 6561b9e..ea70e72 100644 --- a/src/utils/string.hpp +++ b/src/utils/string.hpp @@ -18,6 +18,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ + #ifndef UTILS_STRING_HPP #define UTILS_STRING_HPP @@ -28,4 +29,4 @@ namespace utils std::string toupper(std::string); } -#endif +#endif // UTILS_STRING_HPP |