summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-18 18:51:15 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-18 18:51:15 +0300
commite469ab2f1940cb04b53bb3b72cc7b5a0cd0669b0 (patch)
treebfeb4a907acd9e0b6838e393eccf3bf6da44ccad
parentc8b1e6e5455dd0c9c51b6b212478ed1e5aa1af4c (diff)
downloadmv-e469ab2f1940cb04b53bb3b72cc7b5a0cd0669b0.tar.gz
mv-e469ab2f1940cb04b53bb3b72cc7b5a0cd0669b0.tar.bz2
mv-e469ab2f1940cb04b53bb3b72cc7b5a0cd0669b0.tar.xz
mv-e469ab2f1940cb04b53bb3b72cc7b5a0cd0669b0.zip
Add some clang fixes.
-rw-r--r--src/gui/gui.cpp10
-rw-r--r--src/gui/windows/skilldialog.cpp7
-rw-r--r--src/net/eathena/beingrecv.cpp3
-rw-r--r--src/render/graphics_calcImageRect.hpp3
-rw-r--r--src/resources/db/mapdb.cpp4
-rw-r--r--src/resources/mapreader.cpp7
6 files changed, 21 insertions, 13 deletions
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index f0a4137c1..410891416 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -275,7 +275,10 @@ Gui::~Gui()
if (windowContainer)
windowContainer->slowLogic();
- delete getTop();
+ Widget *top = mTop;
+ if (Widget::widgetExists(mTop))
+ setTop(nullptr);
+ delete top;
delete2(mGuiFont);
delete2(boldFont);
@@ -283,14 +286,9 @@ Gui::~Gui()
delete2(mSecureFont);
delete2(mInfoParticleFont);
delete2(mNpcFont);
-
delete2(guiInput);
-
delete2(theme);
- if (Widget::widgetExists(mTop))
- setTop(nullptr);
-
delete2(mFocusHandler);
Label::finalCleanup();
Tab::finalCleanup();
diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp
index 69e5f5bf3..b973c09be 100644
--- a/src/gui/windows/skilldialog.cpp
+++ b/src/gui/windows/skilldialog.cpp
@@ -874,8 +874,11 @@ void SkillDialog::useSkillTarget(const SkillInfo *const info,
{
if (!being && autoTarget == AutoTarget_true)
{
- being = localPlayer->setNewTarget(ActorType::Monster,
- AllowSort_true);
+ if (localPlayer)
+ {
+ being = localPlayer->setNewTarget(ActorType::Monster,
+ AllowSort_true);
+ }
}
if (being)
{
diff --git a/src/net/eathena/beingrecv.cpp b/src/net/eathena/beingrecv.cpp
index 915be5cbd..1fc49deaf 100644
--- a/src/net/eathena/beingrecv.cpp
+++ b/src/net/eathena/beingrecv.cpp
@@ -1074,7 +1074,8 @@ void BeingRecv::processSkillCastingContinue(Net::MessageIn &msg,
castTime / MILLISECONDS_IN_A_TICK);
}
}
- if (srcBeing == localPlayer &&
+ if (localPlayer &&
+ srcBeing == localPlayer &&
(inf2 & SkillType2::FreeCastAny) == 0)
{
localPlayer->freezeMoving(castTime / MILLISECONDS_IN_A_TICK);
diff --git a/src/render/graphics_calcImageRect.hpp b/src/render/graphics_calcImageRect.hpp
index c33ec94e6..a0cc73ff7 100644
--- a/src/render/graphics_calcImageRect.hpp
+++ b/src/render/graphics_calcImageRect.hpp
@@ -68,7 +68,8 @@ if (top && left && bottom && right)
calcPatternInline(vert, right, x + w - rw, y + th, rw, h - th - bh);
}
-calcTileVertexesInline(vert, topLeft, x, y);
+if (topLeft)
+ calcTileVertexesInline(vert, topLeft, x, y);
if (topRight)
{
const int trw = topRight->getWidth();
diff --git a/src/resources/db/mapdb.cpp b/src/resources/db/mapdb.cpp
index 48d234bb4..fde608496 100644
--- a/src/resources/db/mapdb.cpp
+++ b/src/resources/db/mapdb.cpp
@@ -213,11 +213,11 @@ const MapInfo *MapDB::getMapAtlas(const std::string &name)
const MapInfo *MapDB::getAtlas(const std::string &name)
{
- MapInfo *const info = new MapInfo;
-
const AtlasCIter it = mAtlases.find(name);
if (it == mAtlases.end())
return nullptr;
+
+ MapInfo *const info = new MapInfo;
info->atlas = name;
info->files = &(*it).second;
return info;
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 0b06fb455..5c6282135 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -1199,7 +1199,12 @@ Tileset *MapReader::readTileset(XmlNodePtr node,
const int duration = XML::getProperty(
frameNode, "duration", 0) / 10;
- ani->addFrame(set->get(tileId), duration, 0, 0, 100);
+ if (set)
+ {
+ ani->addFrame(set->get(tileId),
+ duration,
+ 0, 0, 100);
+ }
}
}