summaryrefslogtreecommitdiff
path: root/src/localplayer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-08 00:17:45 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-08 00:17:45 +0300
commit593cccb16074fe9269dd2f278bd79859769eb1fd (patch)
treed8b3d93001021c59622ea88140dbbef8aee05013 /src/localplayer.cpp
parentb7e35a7bbd41c39fa675e77b2af6a11bb4d86dd2 (diff)
downloadmanaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.gz
manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.bz2
manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.tar.xz
manaplus-593cccb16074fe9269dd2f278bd79859769eb1fd.zip
Improve constructors in some classes.
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r--src/localplayer.cpp76
1 files changed, 36 insertions, 40 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 61764fc40..cba78a449 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -89,9 +89,29 @@ LocalPlayer::LocalPlayer(const int id, const int subtype) :
mUpdateName(true),
mTargetTime(-1),
mLastTarget(-1),
+ mGMLevel(0),
+ mInvertDirection(0),
+ mCrazyMoveType(config.getIntValue("crazyMoveType")),
+ mCrazyMoveState(0),
+ mAttackWeaponType(config.getIntValue("attackWeaponType")),
+ mQuickDropCounter(config.getIntValue("quickDropCounter")),
+ mMoveState(0),
+ mDisableCrazyMove(false),
+ mPickUpType(config.getIntValue("pickUpType")),
+ mMagicAttackType(config.getIntValue("magicAttackType")),
+ mPvpAttackType(config.getIntValue("pvpAttackType")),
+ mMoveToTargetType(config.getIntValue("moveToTargetType")),
+ mAttackType(config.getIntValue("attackType")),
+ mFollowMode(config.getIntValue("followMode")),
+ mImitationMode(config.getIntValue("imitationMode")),
+ mDisableGameModifiers(config.getBoolValue("disableGameModifiers")),
+ mLastTargetX(0),
+ mLastTargetY(0),
mTarget(nullptr),
mPlayerFollowed(""),
mPlayerImitated(""),
+ mNextDestX(0),
+ mNextDestY(0),
mPickUpTarget(nullptr),
mGoingToTarget(false),
mKeepAttacking(false),
@@ -102,11 +122,19 @@ LocalPlayer::LocalPlayer(const int id, const int subtype) :
mMessageTime(0),
mAwayListener(new AwayListener),
mAwayDialog(nullptr),
+ mPingSendTick(0),
+ mWaitPing(false),
+ mPingTime(0),
mAfkTime(0),
mAwayMode(false),
mPseudoAwayMode(false),
mShowNavigePath(false),
- mDrawPath(false),
+ mIsServerBuggy(serverConfig.getValueBool("enableBuggyServers", true)),
+ mSyncPlayerMove(config.getBoolValue("syncPlayerMove")),
+ mDrawPath(config.getBoolValue("drawPath")),
+ mAttackMoving(config.getBoolValue("attackMoving")),
+ mAttackNext(config.getBoolValue("attackNext")),
+ mShowJobExp(config.getBoolValue("showJobExp")),
mActivityTime(0),
mNavigateX(0),
mNavigateY(0),
@@ -117,61 +145,30 @@ LocalPlayer::LocalPlayer(const int id, const int subtype) :
mOldY(0),
mOldTileX(0),
mOldTileY(0),
+ mTargetDeadPlayers(config.getBoolValue("targetDeadPlayers")),
+ mServerAttack(config.getBoolValue("serverAttack")),
mLastHitFrom(""),
mWaitFor(""),
mAdvertTime(0),
mBlockAdvert(false),
+ mEnableAdvert(config.getBoolValue("enableAdvert")),
+ mTradebot(config.getBoolValue("tradebot")),
+ mTargetOnlyReachable(config.getBoolValue("targetOnlyReachable")),
mNextStep(false)
{
logger->log1("LocalPlayer::LocalPlayer");
- mAttackRange = 0;
-
listen(CHANNEL_ATTRIBUTES);
- mLevel = 1;
+ mAttackRange = 0;
+ mLevel = 1;
mAdvanced = true;
-
mTextColor = &Theme::getThemeColor(Theme::PLAYER);
if (userPalette)
mNameColor = &userPalette->getColor(UserPalette::SELF);
else
mNameColor = nullptr;
- mLastTargetX = 0;
- mLastTargetY = 0;
-
- mInvertDirection = 0;
- mCrazyMoveType = config.getIntValue("crazyMoveType");
- mCrazyMoveState = 0;
- mAttackWeaponType = config.getIntValue("attackWeaponType");
- mQuickDropCounter = config.getIntValue("quickDropCounter");
- mMoveState = 0;
- mDisableCrazyMove = false;
- mPickUpType = config.getIntValue("pickUpType");
- mMagicAttackType = config.getIntValue("magicAttackType");
- mPvpAttackType = config.getIntValue("pvpAttackType");
- mMoveToTargetType = config.getIntValue("moveToTargetType");
- mDisableGameModifiers = config.getBoolValue("disableGameModifiers");
- mTargetDeadPlayers = config.getBoolValue("targetDeadPlayers");
- mAttackType = config.getIntValue("attackType");
- mFollowMode = config.getIntValue("followMode");
- mImitationMode = config.getIntValue("imitationMode");
- mIsServerBuggy = serverConfig.getValueBool("enableBuggyServers", true);
- mSyncPlayerMove = config.getBoolValue("syncPlayerMove");
- mDrawPath = config.getBoolValue("drawPath");
- mServerAttack = config.getBoolValue("serverAttack");
- mAttackMoving = config.getBoolValue("attackMoving");
- mAttackNext = config.getBoolValue("attackNext");
- mShowJobExp = config.getBoolValue("showJobExp");
- mEnableAdvert = config.getBoolValue("enableAdvert");
- mTradebot = config.getBoolValue("tradebot");
- mTargetOnlyReachable = config.getBoolValue("targetOnlyReachable");
-
- mPingSendTick = 0;
- mWaitPing = false;
- mPingTime = 0;
-
PlayerInfo::setStatBase(PlayerInfo::WALK_SPEED,
static_cast<int>(getWalkSpeed().x));
PlayerInfo::setStatMod(PlayerInfo::WALK_SPEED, 0);
@@ -1746,7 +1743,6 @@ void LocalPlayer::moveToTarget(int dist)
bool gotPos(false);
Path debugPath;
- Vector targetPos(-1, -1);
const Vector &playerPos = getPosition();
unsigned int limit(0);