Walk ping is not supported anymore

master
Eduardo Bart 11 years ago
parent 06e2b6eca2
commit 04f52d77d2

@ -84,12 +84,6 @@ function updateFps(fps)
end end
function updatePing(ping) function updatePing(ping)
local ping = -1
if g_game.getFeature(GameClientPing) or g_game.getFeature(GameExtendedClientPing) then
ping = g_game.getPing()
else
ping = g_game.getLocalPlayer():getWalkPing()
end
local text = 'Ping: ' local text = 'Ping: '
local color local color
if ping < 0 then if ping < 0 then

@ -32,7 +32,6 @@ LocalPlayer::LocalPlayer()
m_states = 0; m_states = 0;
m_vocation = 0; m_vocation = 0;
m_walkLockExpiration = 0; m_walkLockExpiration = 0;
m_lastWalkPing = -1;
m_skillsLevel.fill(-1); m_skillsLevel.fill(-1);
m_skillsBaseLevel.fill(-1); m_skillsBaseLevel.fill(-1);
@ -77,7 +76,7 @@ bool LocalPlayer::canWalk(Otc::Direction direction)
return false; return false;
// prewalk has a timeout, because for some reason that I don't know yet the server sometimes doesn't answer the prewalk // prewalk has a timeout, because for some reason that I don't know yet the server sometimes doesn't answer the prewalk
bool prewalkTimeouted = m_walking && m_preWalking && m_walkTimer.ticksElapsed() >= getStepDuration() + 5*PREWALK_TIMEOUT; bool prewalkTimeouted = m_walking && m_preWalking && m_walkTimer.ticksElapsed() >= getStepDuration() + PREWALK_TIMEOUT;
// avoid doing more walks than wanted when receiving a lot of walks from server // avoid doing more walks than wanted when receiving a lot of walks from server
if(!m_lastPrewalkDone && m_preWalking && !prewalkTimeouted) if(!m_lastPrewalkDone && m_preWalking && !prewalkTimeouted)
@ -94,13 +93,6 @@ void LocalPlayer::walk(const Position& oldPos, const Position& newPos)
{ {
// a prewalk was going on // a prewalk was going on
if(m_preWalking) { if(m_preWalking) {
if(m_waitingWalkPong) {
if(newPos == m_lastPrewalkDestination)
m_lastWalkPing = m_walkPingTimer.ticksElapsed();
m_waitingWalkPong = false;
}
// switch to normal walking // switch to normal walking
m_preWalking = false; m_preWalking = false;
m_lastPrewalkDone = true; m_lastPrewalkDone = true;
@ -113,7 +105,6 @@ void LocalPlayer::walk(const Position& oldPos, const Position& newPos)
} }
// no prewalk was going on, this must be an server side automated walk // no prewalk was going on, this must be an server side automated walk
else { else {
m_walkPingTimer.restart();
m_serverWalking = true; m_serverWalking = true;
if(m_serverWalkEndEvent) if(m_serverWalkEndEvent)
m_serverWalkEndEvent->cancel(); m_serverWalkEndEvent->cancel();
@ -131,12 +122,6 @@ void LocalPlayer::preWalk(Otc::Direction direction)
return; return;
} }
m_waitingWalkPong = false;
if(m_walkPingTimer.ticksElapsed() > getStepDuration() && m_idleTimer.ticksElapsed() > getStepDuration()*2) {
m_waitingWalkPong = true;
m_walkPingTimer.restart();
}
m_preWalking = true; m_preWalking = true;
if(m_serverWalkEndEvent) if(m_serverWalkEndEvent)
@ -155,8 +140,6 @@ void LocalPlayer::cancelWalk(Otc::Direction direction)
stopWalk(); stopWalk();
m_lastPrewalkDone = true; m_lastPrewalkDone = true;
m_waitingWalkPong = false;
m_walkPingTimer.restart();
m_idleTimer.restart(); m_idleTimer.restart();
lockWalk(); lockWalk();

@ -29,7 +29,7 @@
class LocalPlayer : public Player class LocalPlayer : public Player
{ {
enum { enum {
PREWALK_TIMEOUT = 1000 PREWALK_TIMEOUT = 5000
}; };
public: public:
@ -69,7 +69,6 @@ public:
int getSkillBaseLevel(Otc::Skill skill) { return m_skillsBaseLevel[skill]; } int getSkillBaseLevel(Otc::Skill skill) { return m_skillsBaseLevel[skill]; }
int getSkillLevelPercent(Otc::Skill skill) { return m_skillsLevelPercent[skill]; } int getSkillLevelPercent(Otc::Skill skill) { return m_skillsLevelPercent[skill]; }
int getVocation() { return m_vocation; } int getVocation() { return m_vocation; }
int getWalkPing() { return m_lastWalkPing; }
double getHealth() { return m_health; } double getHealth() { return m_health; }
double getMaxHealth() { return m_maxHealth; } double getMaxHealth() { return m_maxHealth; }
double getFreeCapacity() { return m_freeCapacity; } double getFreeCapacity() { return m_freeCapacity; }
@ -119,18 +118,15 @@ protected:
private: private:
// walk related // walk related
Timer m_walkPingTimer;
Position m_lastPrewalkDestination; Position m_lastPrewalkDestination;
Position m_autoWalkDestination; Position m_autoWalkDestination;
Position m_lastAutoWalkPosition; Position m_lastAutoWalkPosition;
ScheduledEventPtr m_serverWalkEndEvent; ScheduledEventPtr m_serverWalkEndEvent;
ScheduledEventPtr m_autoWalkContinueEvent; ScheduledEventPtr m_autoWalkContinueEvent;
ticks_t m_walkLockExpiration; ticks_t m_walkLockExpiration;
int m_lastWalkPing;
stdext::boolean<false> m_preWalking; stdext::boolean<false> m_preWalking;
stdext::boolean<true> m_lastPrewalkDone; stdext::boolean<true> m_lastPrewalkDone;
stdext::boolean<false> m_serverWalking; stdext::boolean<false> m_serverWalking;
stdext::boolean<false> m_waitingWalkPong;
stdext::boolean<false> m_knownCompletePath; stdext::boolean<false> m_knownCompletePath;
stdext::boolean<false> m_premium; stdext::boolean<false> m_premium;

@ -484,7 +484,6 @@ void Client::registerLuaFunctions()
g_lua.bindClassMemberFunction<LocalPlayer>("getTotalCapacity", &LocalPlayer::getTotalCapacity); g_lua.bindClassMemberFunction<LocalPlayer>("getTotalCapacity", &LocalPlayer::getTotalCapacity);
g_lua.bindClassMemberFunction<LocalPlayer>("getInventoryItem", &LocalPlayer::getInventoryItem); g_lua.bindClassMemberFunction<LocalPlayer>("getInventoryItem", &LocalPlayer::getInventoryItem);
g_lua.bindClassMemberFunction<LocalPlayer>("getVocation", &LocalPlayer::getVocation); g_lua.bindClassMemberFunction<LocalPlayer>("getVocation", &LocalPlayer::getVocation);
g_lua.bindClassMemberFunction<LocalPlayer>("getWalkPing", &LocalPlayer::getWalkPing);
g_lua.bindClassMemberFunction<LocalPlayer>("isPremium", &LocalPlayer::isPremium); g_lua.bindClassMemberFunction<LocalPlayer>("isPremium", &LocalPlayer::isPremium);
g_lua.bindClassMemberFunction<LocalPlayer>("isKnown", &LocalPlayer::isKnown); g_lua.bindClassMemberFunction<LocalPlayer>("isKnown", &LocalPlayer::isKnown);
g_lua.bindClassMemberFunction<LocalPlayer>("isPreWalking", &LocalPlayer::isPreWalking); g_lua.bindClassMemberFunction<LocalPlayer>("isPreWalking", &LocalPlayer::isPreWalking);

Loading…
Cancel
Save