summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-03-30 02:05:40 +0300
committerAndrei Karas <akaras@inbox.ru>2012-04-01 03:11:26 +0300
commita39f63cdfa5ce15b22f294a8bb1db3a036ce462d (patch)
tree4de71bde947cae0cf5d3196cd97e82f5bc537c5c
parent02ec4369acfbf261236631e20dbb76131e7889f8 (diff)
downloadplus-a39f63cdfa5ce15b22f294a8bb1db3a036ce462d.tar.gz
plus-a39f63cdfa5ce15b22f294a8bb1db3a036ce462d.tar.bz2
plus-a39f63cdfa5ce15b22f294a8bb1db3a036ce462d.tar.xz
plus-a39f63cdfa5ce15b22f294a8bb1db3a036ce462d.zip
One part of fixes after auto checking.
-rw-r--r--src/actorspritemanager.cpp4
-rw-r--r--src/actorspritemanager.h4
-rw-r--r--src/client.cpp11
-rw-r--r--src/configuration.h2
-rw-r--r--src/debug/debug_new.cpp18
-rw-r--r--src/debug/fast_mutex.h2
-rw-r--r--src/game.cpp5
-rw-r--r--src/gui/botcheckerwindow.cpp47
-rw-r--r--src/gui/chatwindow.cpp83
-rw-r--r--src/gui/skilldialog.h1
-rw-r--r--src/gui/widgets/avatarlistbox.cpp17
-rw-r--r--src/gui/widgets/chattab.h2
-rw-r--r--src/guildmanager.cpp12
-rw-r--r--src/net/download.cpp6
-rw-r--r--src/net/ea/inventoryhandler.h4
-rw-r--r--src/net/manaserv/attributes.cpp5
-rw-r--r--src/net/manaserv/buysellhandler.cpp2
-rw-r--r--src/net/manaserv/inventoryhandler.h2
-rw-r--r--src/net/tmwa/charserverhandler.cpp21
-rw-r--r--src/net/tmwa/chathandler.cpp9
-rw-r--r--src/net/tmwa/generalhandler.cpp3
-rw-r--r--src/resources/resourcemanager.h2
-rw-r--r--src/utils/stringutils.cpp4
-rw-r--r--src/utils/stringutils.h4
24 files changed, 149 insertions, 121 deletions
diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp
index af30b2fa6..eb0d1da38 100644
--- a/src/actorspritemanager.cpp
+++ b/src/actorspritemanager.cpp
@@ -1323,7 +1323,7 @@ void ActorSpriteManager::parseLevels(std::string levels)
{
levels += ", ";
unsigned int f = 0;
- unsigned long pos = 0;
+ std::string::size_type pos = 0;
const std::string brkEnd = "), ";
pos = levels.find(brkEnd, f);
@@ -1332,7 +1332,7 @@ void ActorSpriteManager::parseLevels(std::string levels)
std::string part = levels.substr(f, pos - f);
if (part.empty())
break;
- unsigned long bktPos = part.rfind("(");
+ std::string::size_type bktPos = part.rfind("(");
if (bktPos != std::string::npos)
{
Being *being = findBeingByName(part.substr(0, bktPos),
diff --git a/src/actorspritemanager.h b/src/actorspritemanager.h
index 74ee3b095..6d56b0309 100644
--- a/src/actorspritemanager.h
+++ b/src/actorspritemanager.h
@@ -245,10 +245,10 @@ class ActorSpriteManager: public ConfigListener
{ mAttackMobs = mobs; }
int getPriorityAttackMobsSize() const
- { return mPriorityAttackMobs.size(); }
+ { return static_cast<int>(mPriorityAttackMobs.size()); }
int getAttackMobsSize() const
- { return mAttackMobs.size(); }
+ { return static_cast<int>(mAttackMobs.size()); }
std::list<std::string> getIgnoreAttackMobs() const
{ return mIgnoreAttackMobs; }
diff --git a/src/client.cpp b/src/client.cpp
index 62147874d..0024b16de 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -484,7 +484,7 @@ void Client::gameInit()
icon = LoadIcon(GetModuleHandle(nullptr), "A");
if (icon)
- SetClassLong(pInfo.window, GCL_HICON, (LONG) icon);
+ SetClassLong(pInfo.window, GCL_HICON, static_cast<LONG>(icon));
#else
mIcon = IMG_Load(iconFile.c_str());
if (mIcon)
@@ -2271,15 +2271,16 @@ bool Client::checkPackets(int type)
if (!serverConfig.getValueBool("enableBuggyServers", true))
return true;
- int timeLimit = instance()->mPacketLimits[type].timeLimit;
+ PacketLimit &limit = instance()->mPacketLimits[type];
+ int timeLimit = limit.timeLimit;
if (!timeLimit)
return true;
int time = tick_time;
- int lastTime = instance()->mPacketLimits[type].lastTime;
- int cnt = instance()->mPacketLimits[type].cnt;
- int cntLimit = instance()->mPacketLimits[type].cntLimit;
+ int lastTime = limit.lastTime;
+ int cnt = limit.cnt;
+ int cntLimit = limit.cntLimit;
if (lastTime > tick_time)
{
diff --git a/src/configuration.h b/src/configuration.h
index 2715ea59c..696ddcf3a 100644
--- a/src/configuration.h
+++ b/src/configuration.h
@@ -184,7 +184,7 @@ class ConfigurationObject
return container;
for (ConfigurationList::const_iterator it = list->begin();
- it != list->end(); it++)
+ it != list->end(); ++ it)
{
container = manager->readConfigItem(*it, container);
}
diff --git a/src/debug/debug_new.cpp b/src/debug/debug_new.cpp
index fb83cab4a..30834feed 100644
--- a/src/debug/debug_new.cpp
+++ b/src/debug/debug_new.cpp
@@ -131,7 +131,7 @@
* Windows command prompt.
*/
#ifndef M_DEBUG_NEW_PROGNAME
-#define M_DEBUG_NEW_PROGNAME NULL
+#define M_DEBUG_NEW_PROGNAME nullptr
#endif
/**
@@ -311,7 +311,7 @@ const char* new_progname = M_DEBUG_NEW_PROGNAME;
*/
static bool print_position_from_addr(const void* addr)
{
- static const void* last_addr = NULL;
+ static const void* last_addr = nullptr;
static char last_info[256] = "";
if (addr == last_addr)
{
@@ -416,7 +416,7 @@ static void print_position(const void* ptr, int line)
{
fprintf(new_output_fp, "%s:%d", (const char*)ptr, line);
}
- else if (ptr != NULL) // Is caller address present?
+ else if (ptr != nullptr) // Is caller address present?
{
if (!print_position_from_addr(ptr)) // Fail to get source position?
fprintf(new_output_fp, "%p", ptr);
@@ -467,10 +467,10 @@ static void* alloc_mem(size_t size, const char* file, int line, bool is_array)
STATIC_ASSERT(M_DEBUG_NEW_TAILCHECK >= 0, Invalid_tail_check_length);
size_t s = size + ALIGNED_LIST_ITEM_SIZE + M_DEBUG_NEW_TAILCHECK;
new_ptr_list_t* ptr = (new_ptr_list_t*)malloc(s);
- if (ptr == NULL)
+ if (ptr == nullptr)
{
#if M_DEBUG_NEW_STD_OPER_NEW
- return NULL;
+ return nullptr;
#else
fast_mutex_autolock lock(new_output_lock);
fprintf(new_output_fp,
@@ -537,7 +537,7 @@ static void* alloc_mem(size_t size, const char* file, int line, bool is_array)
*/
static void free_pointer(void* pointer, void* addr, bool is_array)
{
- if (pointer == NULL)
+ if (pointer == nullptr)
return;
new_ptr_list_t* ptr =
(new_ptr_list_t*)((char*)pointer - ALIGNED_LIST_ITEM_SIZE);
@@ -726,7 +726,7 @@ int check_mem_corruption()
void __debug_new_recorder::_M_process(void* pointer)
{
- if (pointer == NULL)
+ if (pointer == nullptr)
return;
new_ptr_list_t* ptr =
(new_ptr_list_t*)((char*)pointer - ALIGNED_LIST_ITEM_SIZE);
@@ -773,12 +773,12 @@ void* operator new [](size_t size, const char* file, int line)
#endif
}
-void* operator new (size_t size) throw(std::bad_alloc)
+void* operator new (size_t size) //throw(std::bad_alloc)
{
return operator new (size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0);
}
-void* operator new [](size_t size) throw(std::bad_alloc)
+void* operator new [](size_t size) //throw(std::bad_alloc)
{
return operator new [](size, (char*)M_DEBUG_NEW_CALLER_ADDRESS, 0);
}
diff --git a/src/debug/fast_mutex.h b/src/debug/fast_mutex.h
index 60ad1f305..1380c683b 100644
--- a/src/debug/fast_mutex.h
+++ b/src/debug/fast_mutex.h
@@ -130,7 +130,7 @@
: _M_locked(false)
# endif
{
- ::pthread_mutex_init(&_M_mtx_impl, NULL);
+ ::pthread_mutex_init(&_M_mtx_impl, nullptr);
# if _FAST_MUTEX_CHECK_INITIALIZATION
_M_initialized = true;
# endif
diff --git a/src/game.cpp b/src/game.cpp
index e20b6c5df..143751731 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -900,7 +900,7 @@ void Game::handleActive(SDL_Event &event)
if (event.active.gain)
{ // window restore
Client::setIsMinimized(false);
- if (!player_node && !player_node->getAway())
+ if (player_node && !player_node->getAway())
fpsLimit = config.getIntValue("fpslimit");
if (player_node)
player_node->setHalfAway(false);
@@ -983,7 +983,8 @@ void Game::handleInput()
{
try
{
- guiInput->pushInput(event);
+ if (guiInput)
+ guiInput->pushInput(event);
}
catch (const gcn::Exception &e)
{
diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp
index a1ad9cc2a..9265ff203 100644
--- a/src/gui/botcheckerwindow.cpp
+++ b/src/gui/botcheckerwindow.cpp
@@ -127,44 +127,45 @@ public:
if (!mPlayers.at(r))
continue;
- std::string name = mPlayers.at(r)->getName();
+ Being *player = mPlayers.at(r);
+ std::string name = player->getName();
gcn::Widget *widget = new Label(name);
mWidgets.push_back(widget);
- if (mPlayers.at(r)->getAttackTime() != 0)
+ if (player->getAttackTime() != 0)
{
widget = new Label(toString(curTime
- - mPlayers.at(r)->getAttackTime()));
+ - player->getAttackTime()));
}
else
{
widget = new Label(toString(curTime
- - mPlayers.at(r)->getTestTime()) + "?");
+ - player->getTestTime()) + "?");
}
mWidgets.push_back(widget);
- if (mPlayers.at(r)->getTalkTime() != 0)
+ if (player->getTalkTime() != 0)
{
widget = new Label(toString(curTime
- - mPlayers.at(r)->getTalkTime()));
+ - player->getTalkTime()));
}
else
{
widget = new Label(toString(curTime
- - mPlayers.at(r)->getTestTime()) + "?");
+ - player->getTestTime()) + "?");
}
mWidgets.push_back(widget);
- if (mPlayers.at(r)->getMoveTime() != 0)
+ if (player->getMoveTime() != 0)
{
widget = new Label(toString(curTime
- - mPlayers.at(r)->getMoveTime()));
+ - player->getMoveTime()));
}
else
{
widget = new Label(toString(curTime
- - mPlayers.at(r)->getTestTime()) + "?");
+ - player->getTestTime()) + "?");
}
mWidgets.push_back(widget);
@@ -174,20 +175,20 @@ public:
bool attackBot = false;
bool otherBot = false;
- if (curTime - mPlayers.at(r)->getTestTime() > 2 * 60)
+ if (curTime - player->getTestTime() > 2 * 60)
{
- int attack = curTime - (mPlayers.at(r)->getAttackTime()
- ? mPlayers.at(r)->getAttackTime()
- : mPlayers.at(r)->getTestTime());
- int talk = curTime - (mPlayers.at(r)->getTalkTime()
- ? mPlayers.at(r)->getTalkTime()
- : mPlayers.at(r)->getTestTime()) - attack;
- int move = curTime - (mPlayers.at(r)->getMoveTime()
- ? mPlayers.at(r)->getMoveTime()
- : mPlayers.at(r)->getTestTime()) - attack;
- int other = curTime - (mPlayers.at(r)->getOtherTime()
- ? mPlayers.at(r)->getMoveTime()
- : mPlayers.at(r)->getOtherTime()) - attack;
+ int attack = curTime - (player->getAttackTime()
+ ? player->getAttackTime()
+ : player->getTestTime());
+ int talk = curTime - (player->getTalkTime()
+ ? player->getTalkTime()
+ : player->getTestTime()) - attack;
+ int move = curTime - (player->getMoveTime()
+ ? player->getMoveTime()
+ : player->getTestTime()) - attack;
+ int other = curTime - (player->getOtherTime()
+ ? player->getMoveTime()
+ : player->getOtherTime()) - attack;
if (attack < 2 * 60)
attackBot = true;
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 0403b5e17..29c3abe51 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -510,8 +510,11 @@ void ChatWindow::action(const gcn::ActionEvent &event)
}
else if (event.getId() == ACTION_COLOR_PICKER)
{
- mChatColor = mColorPicker->getSelected();
- config.setValue("chatColor", mChatColor);
+ if (mColorPicker)
+ {
+ mChatColor = mColorPicker->getSelected();
+ config.setValue("chatColor", mChatColor);
+ }
}
if (mColorPicker && mColorPicker->isVisible()
@@ -737,7 +740,8 @@ void ChatWindow::mouseReleased(gcn::MouseEvent &event A_UNUSED)
void ChatWindow::keyPressed(gcn::KeyEvent &event)
{
- if (event.getKey().getValue() == Key::DOWN)
+ const int key = event.getKey().getValue();
+ if (key == Key::DOWN)
{
if (mCurHist != mHistory.end())
{
@@ -756,12 +760,12 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
mCurHist = prevHist;
}
}
- else if (mChatInput->getText() != "")
+ else if (!mChatInput->getText().empty())
{
mChatInput->setText("");
}
}
- else if (event.getKey().getValue() == Key::UP &&
+ else if (key == Key::UP &&
mCurHist != mHistory.begin() && !mHistory.empty())
{
// Move backward through the history
@@ -770,7 +774,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
mChatInput->setCaretPosition(static_cast<unsigned>(
mChatInput->getText().length()));
}
- else if (event.getKey().getValue() == Key::INSERT &&
+ else if (key == Key::INSERT &&
mChatInput->getText() != "")
{
// Add the current message to the history and clear the text
@@ -812,8 +816,8 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
std::list<std::string>::const_iterator it;
unsigned int f = 0;
- for (it = tab->getRows().begin();
- it != tab->getRows().end(); ++it, f++)
+ const std::list<std::string> &rows = tab->getRows();
+ for (it = rows.begin(); it != rows.end(); ++it, f++)
{
if (f == mChatHistoryIndex)
mChatInput->setText(*it);
@@ -857,25 +861,48 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event)
}
}
- std::string Temp;
- switch (event.getKey().getValue())
+ std::string temp;
+ switch (key)
{
- case Key::F2: Temp = "\u2318"; break;
- case Key::F3: Temp = "\u263A"; break;
- case Key::F4: Temp = "\u2665"; break;
- case Key::F5: Temp = "\u266A"; break;
- case Key::F6: Temp = "\u266B"; break;
- case Key::F7: Temp = "\u26A0"; break;
- case Key::F8: Temp = "\u2622"; break;
- case Key::F9: Temp = "\u262E"; break;
- case Key::F10: Temp = "\u2605"; break;
- case Key::F11: Temp = "\u2618"; break;
- case Key::F12: Temp = "\u2592"; break;
- default: break;
+ case Key::F2:
+ temp = "\u2318";
+ break;
+ case Key::F3:
+ temp = "\u263A";
+ break;
+ case Key::F4:
+ temp = "\u2665";
+ break;
+ case Key::F5:
+ temp = "\u266A";
+ break;
+ case Key::F6:
+ temp = "\u266B";
+ break;
+ case Key::F7:
+ temp = "\u26A0";
+ break;
+ case Key::F8:
+ temp = "\u2622";
+ break;
+ case Key::F9:
+ temp = "\u262E";
+ break;
+ case Key::F10:
+ temp = "\u2605";
+ break;
+ case Key::F11:
+ temp = "\u2618";
+ break;
+ case Key::F12:
+ temp = "\u2592";
+ break;
+ default:
+ break;
}
- if (Temp != "")
- addInputText(Temp, false);
+ if (temp != "")
+ addInputText(temp, false);
}
void ChatWindow::processEvent(Channels channel, const DepricatedEvent &event)
@@ -1343,7 +1370,7 @@ void ChatWindow::resortChatLog(std::string line, Own own,
return;
}
- unsigned long idx = line.find(": \302\202");
+ std::string::size_type idx = line.find(": \302\202");
if (idx != std::string::npos)
{
line = line.erase(idx + 2, 2);
@@ -1351,13 +1378,13 @@ void ChatWindow::resortChatLog(std::string line, Own own,
return;
}
- unsigned long idx1 = line.find("@@");
+ std::string::size_type idx1 = line.find("@@");
if (idx1 != std::string::npos)
{
- unsigned long idx2 = line.find("|", idx1);
+ std::string::size_type idx2 = line.find("|", idx1);
if (idx2 != std::string::npos)
{
- unsigned long idx3 = line.find("@@", idx2);
+ std::string::size_type idx3 = line.find("@@", idx2);
if (idx3 != std::string::npos)
{
tradeChatTab->chatLog(line, own, ignoreRecord,
diff --git a/src/gui/skilldialog.h b/src/gui/skilldialog.h
index 7fc09d5a6..08371e523 100644
--- a/src/gui/skilldialog.h
+++ b/src/gui/skilldialog.h
@@ -31,6 +31,7 @@
#include <guichan/mouselistener.hpp>
#include <map>
+#include <vector>
#define SKILL_MIN_ID 200000
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 749837f7d..b4fc4fad0 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -343,16 +343,15 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event)
{
case AVATAR_PLAYER:
{
- Being* being = actorSpriteManager->findBeingByName(
- model->getAvatarAt(selected)->getName(), Being::PLAYER);
- if (being)
+ Avatar *avatar = model->getAvatarAt(selected);
+ if (avatar)
{
- viewport->showPopup(being);
- }
- else
- {
- viewport->showPlayerPopup(
- model->getAvatarAt(selected)->getName());
+ Being* being = actorSpriteManager->findBeingByName(
+ avatar->getName(), Being::PLAYER);
+ if (being)
+ viewport->showPopup(being);
+ else
+ viewport->showPlayerPopup(avatar->getName());
}
break;
}
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index d11a85138..455152693 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -171,7 +171,7 @@ class ChatTab : public Tab
friend class WhisperWindow;
virtual void setCurrent()
- { setFlash(false); }
+ { setFlash(0); }
virtual void handleInput(const std::string &msg);
diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp
index 9a4437934..e7ca24587 100644
--- a/src/guildmanager.cpp
+++ b/src/guildmanager.cpp
@@ -273,8 +273,8 @@ bool GuildManager::process(std::string msg)
if (!guild)
return false;
// logger->log("welcome message: %s", msg.c_str());
- int pos = msg.find("! (");
- if (pos == static_cast<int>(std::string::npos))
+ std::string::size_type pos = msg.find("! (");
+ if (pos == std::string::npos)
return false;
msg = msg.substr(0, pos);
guild->setName(msg);
@@ -290,8 +290,8 @@ bool GuildManager::process(std::string msg)
Guild *guild = createGuild();
if (!guild)
return false;
- int pos = msg.find("Access Level: ");
- if (pos == (int)std::string::npos)
+ std::string::size_type pos = msg.find("Access Level: ");
+ if (pos == std::string::npos)
return false;
msg = msg.substr(pos);
@@ -299,7 +299,7 @@ bool GuildManager::process(std::string msg)
return false;
pos = msg.find(", Guild:");
- if (pos == static_cast<int>(std::string::npos))
+ if (pos == std::string::npos)
return false;
int level = atoi(msg.substr(0, pos).c_str());
@@ -310,7 +310,7 @@ bool GuildManager::process(std::string msg)
msg = msg.substr(pos + strlen(", Guild:"));
pos = msg.find(", No. Of Online Players: ");
- if (pos == static_cast<int>(std::string::npos))
+ if (pos == std::string::npos)
return false;
msg = msg.substr(0, pos);
diff --git a/src/net/download.cpp b/src/net/download.cpp
index bc8ea4f72..355d30eca 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -64,7 +64,7 @@ Download::Download(void *ptr, const std::string &url,
mError = static_cast<char*>(calloc(CURL_ERROR_SIZE + 1, 1));
mError[0] = 0;
- mOptions.cancel = false;
+ mOptions.cancel = 0;
}
Download::~Download()
@@ -114,7 +114,7 @@ void Download::noCache()
void Download::setFile(const std::string &filename, Sint64 adler32)
{
- mOptions.memoryWrite = false;
+ mOptions.memoryWrite = 0;
mFileName = filename;
if (adler32 > -1)
@@ -124,7 +124,7 @@ void Download::setFile(const std::string &filename, Sint64 adler32)
}
else
{
- mOptions.checkAdler = false;
+ mOptions.checkAdler = 0;
}
}
diff --git a/src/net/ea/inventoryhandler.h b/src/net/ea/inventoryhandler.h
index c2e076751..b868b5dfa 100644
--- a/src/net/ea/inventoryhandler.h
+++ b/src/net/ea/inventoryhandler.h
@@ -114,8 +114,8 @@ class InventoryItem
int slot;
int id;
int quantity;
- unsigned char color;
int refine;
+ unsigned char color;
bool equip;
InventoryItem(int slot0, int id0, int quantity0, int refine0,
@@ -123,8 +123,8 @@ class InventoryItem
slot(slot0),
id(id0),
quantity(quantity0),
- color(color0),
refine(refine0),
+ color(color0),
equip(equip0)
{
}
diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp
index 9d1e159ff..eb0f72dc5 100644
--- a/src/net/manaserv/attributes.cpp
+++ b/src/net/manaserv/attributes.cpp
@@ -350,8 +350,9 @@ namespace Attributes
continue;
}
}
- logger->log("Found %d tags for %d attributes.", int(tags.size()),
- int(attributes.size()));
+ logger->log("Found %d tags for %d attributes.",
+ static_cast<int>(tags.size()),
+ static_casr<int>(attributes.size()));
fillLabels();
diff --git a/src/net/manaserv/buysellhandler.cpp b/src/net/manaserv/buysellhandler.cpp
index 25db86cf0..e9be139f6 100644
--- a/src/net/manaserv/buysellhandler.cpp
+++ b/src/net/manaserv/buysellhandler.cpp
@@ -97,7 +97,7 @@ void BuySellHandler::handleMessage(Net::MessageIn &msg)
int itemId = msg.readInt16();
int amount = msg.readInt16();
int value = msg.readInt16();
- dialog->addItem(new Item(itemId, amount, 1, false), value);
+ dialog->addItem(new Item(itemId, amount, 0, 1, false), value);
}
break;
}
diff --git a/src/net/manaserv/inventoryhandler.h b/src/net/manaserv/inventoryhandler.h
index 88bb0510d..0241bcc7f 100644
--- a/src/net/manaserv/inventoryhandler.h
+++ b/src/net/manaserv/inventoryhandler.h
@@ -36,7 +36,7 @@ class EquipBackend : public Equipment::Backend
{
public:
EquipBackend()
- { memset(mEquipment, 0, sizeof(*mEquipment); }
+ { memset(mEquipment, 0, sizeof(*mEquipment)); }
Item *getEquipment(int index) const
{ return mEquipment[index]; }
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 6202070bb..04274a70b 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -174,13 +174,14 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
LocalPlayer *tempPlayer = new LocalPlayer(msg.readInt32(), 0);
tempPlayer->setGender(token.sex);
- character->data.mAttributes[EXP] = msg.readInt32();
- character->data.mAttributes[MONEY] = msg.readInt32();
- character->data.mStats[JOB].exp = msg.readInt32();
+ PlayerInfoBackend &data = character->data;
+ data.mAttributes[EXP] = msg.readInt32();
+ data.mAttributes[MONEY] = msg.readInt32();
+ data.mStats[JOB].exp = msg.readInt32();
int temp = msg.readInt32();
- character->data.mStats[JOB].base = temp;
- character->data.mStats[JOB].mod = temp;
+ data.mStats[JOB].base = temp;
+ data.mStats[JOB].mod = temp;
int shoes = msg.readInt16();
int gloves = msg.readInt16();
@@ -192,10 +193,10 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
msg.readInt32(); // manner
msg.readInt16(); // character points left
- character->data.mAttributes[HP] = msg.readInt16();
- character->data.mAttributes[MAX_HP] = msg.readInt16();
- character->data.mAttributes[MP] = msg.readInt16();
- character->data.mAttributes[MAX_MP] = msg.readInt16();
+ data.mAttributes[HP] = msg.readInt16();
+ data.mAttributes[MAX_HP] = msg.readInt16();
+ data.mAttributes[MP] = msg.readInt16();
+ data.mAttributes[MAX_MP] = msg.readInt16();
msg.readInt16(); // speed
tempPlayer->setSubtype(msg.readInt16()); // class (used for race)
@@ -203,7 +204,7 @@ void CharServerHandler::readPlayerData(Net::MessageIn &msg,
Uint16 weapon = msg.readInt16(); // server not used it. may be need use?
tempPlayer->setSprite(SPRITE_WEAPON, weapon, "", 1, true);
- character->data.mAttributes[LEVEL] = msg.readInt16();
+ data.mAttributes[LEVEL] = msg.readInt16();
msg.readInt16(); // skill point
int bottomClothes = msg.readInt16();
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 7830d3a81..2323631cb 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -172,12 +172,9 @@ void ChatHandler::sendRaw(const std::string &args)
line = line.substr(pos + 1);
pos = line.find(" ");
}
- if (outMsg)
- {
- if (line != "")
- processRaw(*outMsg, line);
- delete outMsg;
- }
+ if (line != "")
+ processRaw(*outMsg, line);
+ delete outMsg;
}
void ChatHandler::processRaw(MessageOut &outMsg, std::string &line)
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 8f2f25d6d..8188efc73 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -215,8 +215,7 @@ void GeneralHandler::reloadPartially()
void GeneralHandler::unload()
{
- if (mNetwork)
- mNetwork->clearHandlers();
+ clearHandlers();
}
void GeneralHandler::flushNetwork()
diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h
index a941eaf3c..f1bb35691 100644
--- a/src/resources/resourcemanager.h
+++ b/src/resources/resourcemanager.h
@@ -253,7 +253,7 @@ class ResourceManager
static void deleteInstance();
int size() const
- { return mResources.size(); }
+ { return static_cast<int>(mResources.size()); }
typedef std::map<std::string, Resource*> Resources;
typedef Resources::iterator ResourceIterator;
diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp
index b1e464005..5ec7fb931 100644
--- a/src/utils/stringutils.cpp
+++ b/src/utils/stringutils.cpp
@@ -196,14 +196,14 @@ const std::string findSameSubstringI(const std::string &s1,
return s1.substr(0, minLength);
}
-unsigned long findI(std::string str, std::string subStr)
+size_t findI(std::string str, std::string subStr)
{
str = toLower(str);
subStr = toLower(subStr);
return str.find(subStr);
}
-unsigned long findI(std::string text, StringVect &list)
+size_t findI(std::string text, StringVect &list)
{
std::string str = toLower(text);
unsigned long idx;
diff --git a/src/utils/stringutils.h b/src/utils/stringutils.h
index 9fdc0d2f6..94c455025 100644
--- a/src/utils/stringutils.h
+++ b/src/utils/stringutils.h
@@ -134,9 +134,9 @@ int compareStrI(const std::string &a, const std::string &b);
*/
bool isWordSeparator(char chr);
-unsigned long findI(std::string str, std::string subStr);
+size_t findI(std::string str, std::string subStr);
-unsigned long findI(std::string text, StringVect &list);
+size_t findI(std::string text, StringVect &list);
const std::string encodeStr(unsigned int value, unsigned int size = 0);