summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/being.cpp3
-rw-r--r--src/gui/chat.cpp22
-rw-r--r--src/gui/checkbox.cpp14
-rw-r--r--src/gui/npcstringdialog.cpp4
-rw-r--r--src/gui/progressbar.cpp11
-rw-r--r--src/monster.cpp6
-rw-r--r--src/npc.cpp4
7 files changed, 37 insertions, 27 deletions
diff --git a/src/being.cpp b/src/being.cpp
index 7893c97d..96bce027 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -135,6 +135,9 @@ Being::~Being()
delete_all(mSprites);
clearPath();
+ if (player_node->getTarget() == this)
+ player_node->setTarget(NULL);
+
setMap(NULL);
instances--;
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index ba4885fe..89588cee 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -116,12 +116,14 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
// Trim whitespace
trim(line);
+ if (line.empty())
+ return;
+
CHATLOG tmp;
tmp.own = own;
tmp.nick = "";
tmp.text = line;
-
std::string::size_type pos = line.find(" : ");
if (pos != std::string::npos)
{
@@ -331,6 +333,24 @@ void ChatWindow::whisper(const std::string &nick, std::string msg)
}
}
+ trim(msg);
+
+ std::string playerName = player_node->getName();
+ std::string tempNick = recvnick;
+
+ for (unsigned int i = 0; i < playerName.size(); i++)
+ {
+ playerName[i] = (char) tolower(playerName[i]);
+ }
+
+ for (unsigned int i = 0; i < tempNick.size(); i++)
+ {
+ tempNick[i] = (char) tolower(tempNick[i]);
+ }
+
+ if (tempNick.compare(playerName) == 0 || msg.empty())
+ return;
+
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_CHAT_WHISPER);
outMsg.writeInt16(msg.length() + 28);
diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp
index 511ed34c..7fa4fa81 100644
--- a/src/gui/checkbox.cpp
+++ b/src/gui/checkbox.cpp
@@ -45,13 +45,10 @@ CheckBox::CheckBox(const std::string& caption, bool selected):
checkBoxChecked = checkBox->getSubImage(9, 0, 9, 10);
checkBoxDisabled = checkBox->getSubImage(18, 0, 9, 10);
checkBoxDisabledChecked = checkBox->getSubImage(27, 0, 9, 10);
- if (config.getValue("opengl", 0))
- {
- checkBoxNormal->setAlpha(mAlpha);
- checkBoxChecked->setAlpha(mAlpha);
- checkBoxDisabled->setAlpha(mAlpha);
- checkBoxDisabledChecked->setAlpha(mAlpha);
- }
+ checkBoxNormal->setAlpha(mAlpha);
+ checkBoxChecked->setAlpha(mAlpha);
+ checkBoxDisabled->setAlpha(mAlpha);
+ checkBoxDisabledChecked->setAlpha(mAlpha);
checkBox->decRef();
}
@@ -87,8 +84,7 @@ void CheckBox::drawBox(gcn::Graphics* graphics)
else
box = checkBoxDisabled;
- if (config.getValue("guialpha", 0.8) != mAlpha &&
- config.getValue("opengl", 0))
+ if (config.getValue("guialpha", 0.8) != mAlpha)
{
mAlpha = config.getValue("guialpha", 0.8);
checkBoxNormal->setAlpha(mAlpha);
diff --git a/src/gui/npcstringdialog.cpp b/src/gui/npcstringdialog.cpp
index f2ccc3cf..d9bf5682 100644
--- a/src/gui/npcstringdialog.cpp
+++ b/src/gui/npcstringdialog.cpp
@@ -24,13 +24,13 @@
#include "npcstringdialog.h"
#include "textfield.h"
+#include "widgets/layout.h"
+
#include "../npc.h"
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-#include "widgets/layout.h"
-
extern NpcTextDialog *npcTextDialog;
NpcStringDialog::NpcStringDialog():
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index c7ccfe39..0f59371a 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -103,10 +103,7 @@ void ProgressBar::draw(gcn::Graphics *graphics)
{
if (config.getValue("guialpha", 0.8) != mAlpha)
{
- if (config.getValue("opengl", 0))
- mAlpha = config.getValue("guialpha", 0.8);
- else
- mAlpha = 1.0f;
+ mAlpha = config.getValue("guialpha", 0.8);
for (int i = 0; i < 9; i++)
{
mBorder.grid[i]->setAlpha(mAlpha);
@@ -119,7 +116,8 @@ void ProgressBar::draw(gcn::Graphics *graphics)
const int alpha = (int)(mAlpha * 255.0f);
// The bar
- if (mProgress > 0) {
+ if (mProgress > 0)
+ {
graphics->setColor(gcn::Color(mRed, mGreen, mBlue, alpha));
graphics->fillRectangle(gcn::Rectangle(4, 4,
@@ -128,7 +126,8 @@ void ProgressBar::draw(gcn::Graphics *graphics)
}
// The label
- if (!mText.empty()) {
+ if (!mText.empty())
+ {
gcn::Font *f = boldFont;
const int textX = getWidth() / 2;
const int textY = (getHeight() - f->getHeight()) / 2;
diff --git a/src/monster.cpp b/src/monster.cpp
index 8f56560b..610da492 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -76,11 +76,7 @@ Monster::Monster(Uint32 id, Uint16 job, Map *map):
Monster::~Monster()
{
- if (mText)
- {
- delete mText;
- player_node->setTarget(NULL);
- }
+ delete mText;
}
void Monster::logic()
diff --git a/src/npc.cpp b/src/npc.cpp
index 9aa7ad15..b3dd7b11 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -20,7 +20,6 @@
*/
#include "animatedsprite.h"
-#include "localplayer.h"
#include "npc.h"
#include "particle.h"
#include "text.h"
@@ -73,9 +72,6 @@ NPC::NPC(Uint32 id, Uint16 job, Map *map, Network *network):
NPC::~NPC()
{
delete mName;
-
- if (player_node->getTarget() == this)
- player_node->setTarget(NULL);
}
void NPC::setName(const std::string &name)