From b75c2b5e651373c01f3bc2b1fbb2127620f20ecc Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Sun, 29 Dec 2013 19:21:33 +0100 Subject: Small cleanup - Deleted empty constructor rather than throwing, resulting in compiletime errors rather than runtime errors. - Removed some remainings of currentMana - Fixed some compiler warnings regarding structs getting forward declared as classes. --- src/game-server/abilitycomponent.cpp | 7 +++---- src/game-server/abilitycomponent.h | 5 ++--- src/game-server/attribute.h | 7 ++----- src/game-server/attributemanager.h | 2 +- src/game-server/charactercomponent.h | 2 +- src/scripting/lua.cpp | 7 ++----- 6 files changed, 11 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/game-server/abilitycomponent.cpp b/src/game-server/abilitycomponent.cpp index 1ac82cdf..c03eb03d 100644 --- a/src/game-server/abilitycomponent.cpp +++ b/src/game-server/abilitycomponent.cpp @@ -194,7 +194,7 @@ bool AbilityComponent::useAbilityOnDirection(Entity &user, int id, /** * Allows a character to perform a ability */ -bool AbilityComponent::giveAbility(int id, int currentPoints) +bool AbilityComponent::giveAbility(int id) { if (mAbilities.find(id) == mAbilities.end()) { @@ -204,13 +204,12 @@ bool AbilityComponent::giveAbility(int id, int currentPoints) LOG_ERROR("Tried to give not existing ability id " << id << "."); return false; } - return giveAbility(abilityInfo, currentPoints); + return giveAbility(abilityInfo); } return false; } -bool AbilityComponent::giveAbility(const AbilityManager::AbilityInfo *info, - int currentPoints) +bool AbilityComponent::giveAbility(const AbilityManager::AbilityInfo *info) { bool added = mAbilities.insert(std::pair(info->id, AbilityValue(info))).second; diff --git a/src/game-server/abilitycomponent.h b/src/game-server/abilitycomponent.h index 26a9b138..d68e25ae 100644 --- a/src/game-server/abilitycomponent.h +++ b/src/game-server/abilitycomponent.h @@ -61,9 +61,8 @@ public: bool useAbilityOnDirection(Entity &user, int id, ManaServ::BeingDirection direction); - bool giveAbility(int id, int currentMana = 0); - bool giveAbility(const AbilityManager::AbilityInfo *info, - int currentMana = 0); + bool giveAbility(int id); + bool giveAbility(const AbilityManager::AbilityInfo *info); bool hasAbility(int id) const; bool takeAbility(int id); AbilityMap::iterator findAbility(int id); diff --git a/src/game-server/attribute.h b/src/game-server/attribute.h index 0a677b5d..bb2f3c03 100644 --- a/src/game-server/attribute.h +++ b/src/game-server/attribute.h @@ -132,11 +132,8 @@ class AttributeModifiersEffect class Attribute { public: - Attribute() - : mBase(0) - , mMinValue(0) - , mMaxValue(0) - {throw;} // DEBUG; Find improper constructions + // DEBUG; Find improper constructions + Attribute() = delete; Attribute(const AttributeInfo *info); diff --git a/src/game-server/attributemanager.h b/src/game-server/attributemanager.h index 13dcf1fb..46993007 100644 --- a/src/game-server/attributemanager.h +++ b/src/game-server/attributemanager.h @@ -29,7 +29,7 @@ #include "utils/string.h" #include "utils/xml.h" -class AttributeInfo; +struct AttributeInfo; enum ScopeType { diff --git a/src/game-server/charactercomponent.h b/src/game-server/charactercomponent.h index e62fb396..49cd1bec 100644 --- a/src/game-server/charactercomponent.h +++ b/src/game-server/charactercomponent.h @@ -41,7 +41,7 @@ #include class BuySell; -class GameClient; +struct GameClient; class MessageIn; class MessageOut; class Point; diff --git a/src/scripting/lua.cpp b/src/scripting/lua.cpp index 2c61f95d..a6a68cf4 100644 --- a/src/scripting/lua.cpp +++ b/src/scripting/lua.cpp @@ -2258,17 +2258,14 @@ static int entity_show_text_particle(lua_State *s) ** * Valid only for character and monster entities. * - * Enables a ability for a character. + * Enables an ability for a character. */ static int entity_give_ability(lua_State *s) { - // cost_type is ignored until we have more than one cost type Entity *b = checkBeing(s, 1); auto *abilityInfo = checkAbility(s, 2); - const int currentMana = luaL_optint(s, 3, 0); - b->getComponent()->giveAbility(abilityInfo->id, - currentMana); + b->getComponent()->giveAbility(abilityInfo->id); return 0; } -- cgit v1.2.3-70-g09d2