summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorErik Schilling <ablu.erikschilling@gmail.com>2013-12-29 19:21:33 +0100
committerErik Schilling <ablu.erikschilling@gmail.com>2013-12-29 19:23:28 +0100
commitb75c2b5e651373c01f3bc2b1fbb2127620f20ecc (patch)
treed3cee83b20fa2ebb8103caa14f7afe1e91854af7 /src
parent71afa592b2df4b6a01236dd2189c9ba28c9a3fa8 (diff)
downloadmanaserv-b75c2b5e651373c01f3bc2b1fbb2127620f20ecc.tar.gz
manaserv-b75c2b5e651373c01f3bc2b1fbb2127620f20ecc.tar.bz2
manaserv-b75c2b5e651373c01f3bc2b1fbb2127620f20ecc.tar.xz
manaserv-b75c2b5e651373c01f3bc2b1fbb2127620f20ecc.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/game-server/abilitycomponent.cpp7
-rw-r--r--src/game-server/abilitycomponent.h5
-rw-r--r--src/game-server/attribute.h7
-rw-r--r--src/game-server/attributemanager.h2
-rw-r--r--src/game-server/charactercomponent.h2
-rw-r--r--src/scripting/lua.cpp7
6 files changed, 11 insertions, 19 deletions
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<int, AbilityValue>(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 <vector>
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<AbilityComponent>()->giveAbility(abilityInfo->id,
- currentMana);
+ b->getComponent<AbilityComponent>()->giveAbility(abilityInfo->id);
return 0;
}