fix possible walk crash
This commit is contained in:
parent
9abac474dd
commit
3f2071d097
|
@ -22,7 +22,7 @@ local function onFightModeChange(self, selectedFightButton)
|
|||
else
|
||||
fightMode = FightDefensive
|
||||
end
|
||||
if g_game.getFightMode ~= fightMode then
|
||||
if g_game.getFightMode() ~= fightMode then
|
||||
g_game.setFightMode(fightMode)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -99,6 +99,7 @@ MainWindow
|
|||
anchors.top: prev.bottom
|
||||
margin-top: 10
|
||||
margin-right: 5
|
||||
image-color: #ffffff88
|
||||
|
||||
Label
|
||||
!text: tr('Name:')
|
||||
|
@ -186,6 +187,7 @@ MainWindow
|
|||
anchors.left: parent.horizontalCenter
|
||||
anchors.right: parent.right
|
||||
margin-left: 5
|
||||
image-color: #ffffff88
|
||||
|
||||
Label
|
||||
id: searchLabel
|
||||
|
|
|
@ -41,21 +41,17 @@
|
|||
|
||||
Creature::Creature() : Thing()
|
||||
{
|
||||
m_healthPercent = 0;
|
||||
m_showTimedSquare = false;
|
||||
m_showStaticSquare = false;
|
||||
m_id = 0;
|
||||
m_healthPercent = 100;
|
||||
m_speed = 200;
|
||||
m_direction = Otc::South;
|
||||
m_walkAnimationPhase = 0;
|
||||
m_walking = false;
|
||||
m_walkInterval = 0;
|
||||
m_walkAnimationInterval = 0;
|
||||
m_walkTurnDirection = Otc::InvalidDirection;
|
||||
m_skull = Otc::SkullNone;
|
||||
m_shield = Otc::ShieldNone;
|
||||
m_emblem = Otc::EmblemNone;
|
||||
m_shieldBlink = false;
|
||||
m_showShieldTexture = true;
|
||||
m_removed = false;
|
||||
m_informationFont = g_fonts.getFont("verdana-11px-rounded");
|
||||
}
|
||||
|
||||
|
@ -304,16 +300,14 @@ void Creature::walk(const Position& oldPos, const Position& newPos)
|
|||
m_walkTimer.restart();
|
||||
|
||||
// calculates walk interval
|
||||
float interval = 1000;
|
||||
int groundSpeed = 0;
|
||||
|
||||
TilePtr oldTile = g_map.getTile(oldPos);
|
||||
if(oldTile)
|
||||
groundSpeed = oldTile->getGroundSpeed();
|
||||
|
||||
if(groundSpeed != 0)
|
||||
float interval = 1000;
|
||||
if(groundSpeed > 0 && m_speed > 0)
|
||||
interval = (1000.0f * groundSpeed) / m_speed;
|
||||
|
||||
interval = std::ceil(interval / g_game.getServerBeat()) * g_game.getServerBeat();
|
||||
|
||||
m_walkAnimationInterval = interval;
|
||||
|
|
|
@ -115,14 +115,14 @@ protected:
|
|||
TexturePtr m_skullTexture;
|
||||
TexturePtr m_shieldTexture;
|
||||
TexturePtr m_emblemTexture;
|
||||
bool m_showShieldTexture;
|
||||
bool m_shieldBlink;
|
||||
bool m_passable;
|
||||
Boolean<true> m_showShieldTexture;
|
||||
Boolean<false> m_shieldBlink;
|
||||
Boolean<false> m_passable;
|
||||
Color m_timedSquareColor;
|
||||
Color m_staticSquareColor;
|
||||
bool m_showTimedSquare;
|
||||
bool m_showStaticSquare;
|
||||
bool m_removed;
|
||||
Boolean<false> m_showTimedSquare;
|
||||
Boolean<false> m_showStaticSquare;
|
||||
Boolean<false> m_removed;
|
||||
|
||||
FontPtr m_informationFont;
|
||||
Color m_informationColor;
|
||||
|
@ -133,7 +133,7 @@ protected:
|
|||
TilePtr m_walkingTile;
|
||||
int m_walkInterval;
|
||||
int m_walkAnimationInterval;
|
||||
bool m_walking;
|
||||
Boolean<false> m_walking;
|
||||
ScheduledEventPtr m_walkUpdateEvent;
|
||||
Point m_walkOffset;
|
||||
Otc::Direction m_walkTurnDirection;
|
||||
|
|
Loading…
Reference in New Issue