summaryrefslogtreecommitdiff
path: root/src/being/crazymoves.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-09 00:26:41 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-09 00:26:41 +0300
commit9c46394f54db8c1b9e357ad555f3db96251a616d (patch)
treeb1ab9e8ebec6d9b4d91a9b705b6cc0c3682a5fac /src/being/crazymoves.cpp
parente0d14cf8d3c809a0a5291823d3a962a4835a8f6e (diff)
downloadplus-9c46394f54db8c1b9e357ad555f3db96251a616d.tar.gz
plus-9c46394f54db8c1b9e357ad555f3db96251a616d.tar.bz2
plus-9c46394f54db8c1b9e357ad555f3db96251a616d.tar.xz
plus-9c46394f54db8c1b9e357ad555f3db96251a616d.zip
Add some missing checks to being found by paranucker.
Diffstat (limited to 'src/being/crazymoves.cpp')
-rw-r--r--src/being/crazymoves.cpp48
1 files changed, 38 insertions, 10 deletions
diff --git a/src/being/crazymoves.cpp b/src/being/crazymoves.cpp
index 0405a0fcc..9636e6711 100644
--- a/src/being/crazymoves.cpp
+++ b/src/being/crazymoves.cpp
@@ -94,8 +94,12 @@ void CrazyMoves::crazyMove()
void CrazyMoves::crazyMove1()
{
- if (localPlayer->getCurrentAction() == BeingAction::MOVE)
+ if (!localPlayer ||
+ !playerHandler ||
+ localPlayer->getCurrentAction() == BeingAction::MOVE)
+ {
return;
+ }
// if (!PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION))
// return;
@@ -129,8 +133,12 @@ void CrazyMoves::crazyMove1()
void CrazyMoves::crazyMove2()
{
- if (localPlayer->getCurrentAction() == BeingAction::MOVE)
+ if (!localPlayer ||
+ !playerHandler ||
+ localPlayer->getCurrentAction() == BeingAction::MOVE)
+ {
return;
+ }
// if (!PacketLimiter::limitPackets(PacketType::PACKET_DIRECTION))
// return;
@@ -176,8 +184,12 @@ void CrazyMoves::crazyMove2()
void CrazyMoves::crazyMove3()
{
- if (localPlayer->getCurrentAction() == BeingAction::MOVE)
+ if (!localPlayer ||
+ !playerHandler ||
+ localPlayer->getCurrentAction() == BeingAction::MOVE)
+ {
return;
+ }
switch (settings.crazyMoveState)
{
@@ -210,8 +222,11 @@ void CrazyMoves::crazyMove3()
void CrazyMoves::crazyMove4()
{
- if (localPlayer->getCurrentAction() == BeingAction::MOVE)
+ if (!localPlayer ||
+ localPlayer->getCurrentAction() == BeingAction::MOVE)
+ {
return;
+ }
switch (settings.crazyMoveState)
{
@@ -230,8 +245,11 @@ void CrazyMoves::crazyMove4()
void CrazyMoves::crazyMove5()
{
- if (localPlayer->getCurrentAction() == BeingAction::MOVE)
+ if (!localPlayer ||
+ localPlayer->getCurrentAction() == BeingAction::MOVE)
+ {
return;
+ }
switch (settings.crazyMoveState)
{
@@ -250,8 +268,11 @@ void CrazyMoves::crazyMove5()
void CrazyMoves::crazyMove6()
{
- if (localPlayer->getCurrentAction() == BeingAction::MOVE)
+ if (!localPlayer ||
+ localPlayer->getCurrentAction() == BeingAction::MOVE)
+ {
return;
+ }
switch (settings.crazyMoveState)
{
@@ -294,8 +315,11 @@ void CrazyMoves::crazyMove6()
void CrazyMoves::crazyMove7()
{
- if (localPlayer->getCurrentAction() == BeingAction::MOVE)
+ if (!localPlayer ||
+ localPlayer->getCurrentAction() == BeingAction::MOVE)
+ {
return;
+ }
switch (settings.crazyMoveState)
{
@@ -322,7 +346,7 @@ void CrazyMoves::crazyMove7()
void CrazyMoves::crazyMove8()
{
- if (localPlayer->getCurrentAction() == BeingAction::MOVE)
+ if (!localPlayer || localPlayer->getCurrentAction() == BeingAction::MOVE)
return;
const Map *const map = localPlayer->getMap();
if (!map)
@@ -431,7 +455,7 @@ void CrazyMoves::crazyMove9()
int dx = 0;
int dy = 0;
- if (localPlayer->getCurrentAction() == BeingAction::MOVE)
+ if (!localPlayer || localPlayer->getCurrentAction() == BeingAction::MOVE)
return;
switch (settings.crazyMoveState)
@@ -452,7 +476,8 @@ void CrazyMoves::crazyMove9()
settings.crazyMoveState = 2;
if (!localPlayer->allowAction())
return;
- playerHandler->changeAction(BeingAction::SIT);
+ if (playerHandler)
+ playerHandler->changeAction(BeingAction::SIT);
break;
case 2:
settings.crazyMoveState = 3;
@@ -467,6 +492,9 @@ void CrazyMoves::crazyMove9()
void CrazyMoves::crazyMoveAm()
{
+ if (!localPlayer)
+ return;
+
settings.crazyMoveState ++;
if (settings.crazyMoveState < mMoveProgram.length())
{