summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Sehmisch <crush@themanaworld.org>2009-02-11 17:02:16 +0100
committerPhilipp Sehmisch <crush@themanaworld.org>2009-02-11 17:02:16 +0100
commitf262dbd28f08001d70416e3cc4e62273d3fee2cd (patch)
tree539cbc8b27edf696120df0ac26531640c323692f
parentd68f3fa13297cf4c8d29753e48c684496852ceba (diff)
parent63ac001daa7dfc0735dfefd9c2829c8786b4edaf (diff)
downloadMana-f262dbd28f08001d70416e3cc4e62273d3fee2cd.tar.gz
Mana-f262dbd28f08001d70416e3cc4e62273d3fee2cd.tar.bz2
Mana-f262dbd28f08001d70416e3cc4e62273d3fee2cd.tar.xz
Mana-f262dbd28f08001d70416e3cc4e62273d3fee2cd.zip
Merge branch 'master' of git@gitorious.org:tmw/eathena
-rw-r--r--docs/FAQ.txt4
-rw-r--r--packaging/windows/make-translations.vbs40
-rw-r--r--src/Makefile.am2
-rw-r--r--src/being.cpp16
-rw-r--r--src/effectmanager.h3
-rw-r--r--src/game.cpp20
-rw-r--r--src/gui/browserbox.cpp2
-rw-r--r--src/gui/chat.cpp18
-rw-r--r--src/gui/focushandler.cpp2
-rw-r--r--src/gui/inventorywindow.cpp8
-rw-r--r--src/gui/itempopup.cpp8
-rw-r--r--src/gui/login.cpp10
-rw-r--r--src/gui/minimap.cpp2
-rw-r--r--src/gui/playerbox.cpp2
-rw-r--r--src/gui/popupmenu.cpp20
-rw-r--r--src/gui/radiobutton.cpp2
-rw-r--r--src/gui/recorder.cpp27
-rw-r--r--src/gui/register.cpp4
-rw-r--r--src/gui/scrollarea.cpp2
-rw-r--r--src/gui/setup_colors.cpp10
-rw-r--r--src/gui/setup_colors.h2
-rw-r--r--src/gui/setup_players.cpp2
-rw-r--r--src/gui/setup_players.h5
-rw-r--r--src/gui/setup_video.cpp4
-rw-r--r--src/gui/shortcutwindow.cpp2
-rw-r--r--src/gui/skill.cpp26
-rw-r--r--src/gui/speechbubble.cpp2
-rw-r--r--src/gui/status.cpp12
-rw-r--r--src/gui/table.cpp4
-rw-r--r--src/gui/truetypefont.cpp2
-rw-r--r--src/gui/updatewindow.cpp12
-rw-r--r--src/gui/widgets/tab.cpp10
-rw-r--r--src/gui/widgets/tabbedarea.cpp2
-rw-r--r--src/joystick.h2
-rw-r--r--src/keyboardconfig.cpp6
-rw-r--r--src/localplayer.cpp5
-rw-r--r--src/main.cpp43
-rw-r--r--src/main.h4
-rw-r--r--src/monster.cpp2
-rw-r--r--src/net/partyhandler.cpp2
-rw-r--r--src/net/playerhandler.cpp8
-rw-r--r--src/particleemitter.cpp4
-rw-r--r--src/party.cpp8
-rw-r--r--src/player.cpp7
-rw-r--r--src/player_relations.cpp2
-rw-r--r--src/resources/colordb.cpp25
-rw-r--r--src/resources/colordb.h14
-rw-r--r--src/resources/emotedb.cpp23
-rw-r--r--src/resources/emotedb.h14
-rw-r--r--src/resources/image.h12
-rw-r--r--src/resources/itemdb.cpp14
-rw-r--r--src/resources/monsterdb.cpp19
-rw-r--r--src/resources/npcdb.cpp6
-rw-r--r--src/resources/resourcemanager.cpp4
-rw-r--r--src/resources/spritedef.cpp4
-rw-r--r--src/simpleanimation.cpp2
-rw-r--r--src/sound.cpp8
-rw-r--r--src/statuseffect.cpp10
-rw-r--r--src/text.cpp4
-rw-r--r--src/text.h2
60 files changed, 271 insertions, 270 deletions
diff --git a/docs/FAQ.txt b/docs/FAQ.txt
index 7c2000fd..b214672e 100644
--- a/docs/FAQ.txt
+++ b/docs/FAQ.txt
@@ -75,9 +75,7 @@ A: There are a lot of ways:
http://sourceforge.net/projects/themanaworld/
- You can be a beta tester. Just play The Mana World and report every
- error to the tracker. Read for more infos on the project page:
-
- http://themanaworld.org/
+ error to the tracker or on the forum.
- Play with The Mana World: more players, more fun! Simple as that! ;-)
diff --git a/packaging/windows/make-translations.vbs b/packaging/windows/make-translations.vbs
index 99e88875..f349b25e 100644
--- a/packaging/windows/make-translations.vbs
+++ b/packaging/windows/make-translations.vbs
@@ -3,15 +3,15 @@ Set WshShell = CreateObject("WScript.Shell")
Dim s, infile, outfile, command
Function CreateFolderIfNonexistent(folder)
- if not fso.FolderExists(folder) then
- fso.CreateFolder(folder)
- end if
+ if not fso.FolderExists(folder) then
+ fso.CreateFolder(folder)
+ end if
end Function
'check for existence of msgfmt
if not fso.FileExists("msgfmt.exe") then
- WScript.echo "msgfmt.exe not found. Please get gettext for windows from http://gnuwin32.sourceforge.net/packages/gettext.htm and copy the files msgfmt.exe and all dll files from the gettext/bin directory into this directory and run this script again."
- WScript.Quit(1)
+ WScript.echo "msgfmt.exe not found. Please get gettext for windows from http://gnuwin32.sourceforge.net/packages/gettext.htm and copy the files msgfmt.exe and all dll files from the gettext/bin directory into this directory and run this script again."
+ WScript.Quit(1)
end if
CreateFolderIfNonexistent("..\..\translations\")
@@ -22,21 +22,21 @@ Set stream = fso.GetFile("..\..\po\LINGUAS").OpenAsTextStream(1, 0)
'iterate contents of translations file
translations = 0
do while not stream.AtEndOfStream
- s = stream.ReadLine()
- if inStr(s, "#") = false then
- 'create the output directory
- CreateFolderIfNonexistent("..\..\translations\" + s)
- CreateFolderIfNonexistent("..\..\translations\" + s + "\LC_MESSAGES")
- 'build the translate command
- infile = "../../po/" + s + ".po"
- outfile = "../../translations/" + s +"/LC_MESSAGES/tmw.mo"
- command = "msgfmt -c -o " + outfile + " " + infile
- 'execute translate command
- errval = WshShell.run(command, 0, true)
- if errval = 0 then
- translations = translations + 1
- end if
- end if
+ s = stream.ReadLine()
+ if inStr(s, "#") = false then
+ 'create the output directory
+ CreateFolderIfNonexistent("..\..\translations\" + s)
+ CreateFolderIfNonexistent("..\..\translations\" + s + "\LC_MESSAGES")
+ 'build the translate command
+ infile = "../../po/" + s + ".po"
+ outfile = "../../translations/" + s +"/LC_MESSAGES/tmw.mo"
+ command = "msgfmt -c -o " + outfile + " " + infile
+ 'execute translate command
+ errval = WshShell.run(command, 0, true)
+ if errval = 0 then
+ translations = translations + 1
+ end if
+ end if
loop
WScript.echo translations, " translations compiled."
diff --git a/src/Makefile.am b/src/Makefile.am
index 926455b2..8de13464 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -350,5 +350,5 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \
# set the include path found by configure
INCLUDES = \
$(all_includes) \
- -DTMW_DATADIR=\""$(pkgdatadir)/"\" \
+ -DPKG_DATADIR=\""$(pkgdatadir)/"\" \
-DLOCALEDIR=\""$(localedir)"\"
diff --git a/src/being.cpp b/src/being.cpp
index 521947e3..0ccf675c 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -221,7 +221,7 @@ void Being::setSpeech(const std::string &text, Uint32 time)
end = mSpeech.find(']', start);
}
- if (mSpeech != "")
+ if (!mSpeech.empty())
mSpeechTime = time <= SPEECH_MAX_TIME ? time : SPEECH_MAX_TIME;
}
@@ -370,8 +370,8 @@ void Being::setDirection(Uint8 direction)
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
- if (mSprites[i] != NULL)
- mSprites[i]->setDirection(dir);
+ if (mSprites[i])
+ mSprites[i]->setDirection(dir);
}
}
@@ -470,7 +470,7 @@ void Being::logic()
// Update sprite animations
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
- if (mSprites[i] != NULL)
+ if (mSprites[i])
{
mSprites[i]->update(tick_time * 10);
}
@@ -500,7 +500,7 @@ void Being::draw(Graphics *graphics, int offsetX, int offsetY) const
for (int i = 0; i < VECTOREND_SPRITE; i++)
{
- if (mSprites[i] != NULL)
+ if (mSprites[i])
{
mSprites[i]->draw(graphics, px, py);
}
@@ -756,14 +756,14 @@ void Being::internalTriggerEffect(int effectId, bool sfx, bool gfx)
return;
}
- if (gfx && ed->mGFXEffect != "") {
+ if (gfx && !ed->mGFXEffect.empty()) {
Particle *selfFX;
selfFX = particleEngine->addEffect(ed->mGFXEffect, 0, 0);
controlParticle(selfFX);
}
- if (sfx && ed->mSFXEffect != "") {
+ if (sfx && !ed->mSFXEffect.empty()) {
sound.playSfx(ed->mSFXEffect);
}
}
@@ -831,7 +831,7 @@ static void initializeHair()
int index = atoi(XML::getProperty(node, "id", "-1").c_str());
std::string value = XML::getProperty(node, "value", "");
- if (index >= 0 && value != "") {
+ if (index >= 0 && !value.empty()) {
if (index >= hairColorsNr) {
hairColorsNr = index + 1;
hairColors.resize(hairColorsNr, "#000000");
diff --git a/src/effectmanager.h b/src/effectmanager.h
index 12fe3133..01c5a6b8 100644
--- a/src/effectmanager.h
+++ b/src/effectmanager.h
@@ -30,8 +30,7 @@ class Being;
class EffectManager
{
-
- public:
+ public:
struct EffectDescription
{
int id;
diff --git a/src/game.cpp b/src/game.cpp
index 48ca1c73..5b701fc1 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -390,7 +390,7 @@ static bool saveScreenshot()
else
{
chatWindow->chatLog(_("Saving screenshot failed!"), BY_SERVER);
- logger->log(_("Error: could not save screenshot."));
+ logger->log("Error: could not save screenshot.");
}
SDL_FreeSurface(screenshot);
@@ -518,8 +518,8 @@ void Game::handleInput()
{
// Input chat window
if (!(chatWindow->isInputFocused() ||
- deathNotice != NULL ||
- weightNotice != NULL))
+ deathNotice ||
+ weightNotice))
{
// Quit by pressing Enter if the exit confirm is there
if (exitConfirm &&
@@ -550,9 +550,9 @@ void Game::handleInput()
keyboard.isKeyActive(keyboard.KEY_OK))
npcIntegerDialog->action(gcn::ActionEvent(NULL, "ok"));
else if (!(keyboard.getKeyValue(
- KeyboardConfig::KEY_TOGGLE_CHAT) ==
+ KeyboardConfig::KEY_TOGGLE_CHAT) ==
keyboard.getKeyValue(
- KeyboardConfig::KEY_OK) &&
+ KeyboardConfig::KEY_OK) &&
(npcStringDialog->isVisible() ||
npcTextDialog->isVisible() ||
npcListDialog->isVisible() ||
@@ -595,11 +595,11 @@ void Game::handleInput()
break;
// Quitting confirmation dialog
case KeyboardConfig::KEY_QUIT:
- if (!exitConfirm)
+ if (!exitConfirm)
{
- exitConfirm = new ConfirmDialog( _("Quit"),
- _("Are you sure you "
- "want to quit?"));
+ exitConfirm = new ConfirmDialog(_("Quit"),
+ _("Are you sure you "
+ "want to quit?"));
exitConfirm->addActionListener(&exitListener);
exitConfirm->requestMoveToTop();
}
@@ -778,7 +778,7 @@ void Game::handleInput()
catch (gcn::Exception e)
{
const char* err = e.getMessage().c_str();
- logger->log(_("Warning: guichan input exception: %s"), err);
+ logger->log("Warning: guichan input exception: %s", err);
}
}
} // End while
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 48b1cda4..a06b9a6e 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -103,7 +103,7 @@ void BrowserBox::addRow(const std::string &row)
newRow += "##<" + bLink.caption;
tmp.erase(0, idx3 + 2);
- if (tmp != "")
+ if (!tmp.empty())
{
newRow += "##>";
}
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 1c0cea13..2845691a 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -91,7 +91,7 @@ Window(""), mNetwork(network), mTmpVisible(false)
// Read the party prefix
std::string partyPrefix = config.getValue("PartyPrefix", "$");
- mPartyPrefix = (partyPrefix == "" ? '$' : partyPrefix.at(0));
+ mPartyPrefix = (partyPrefix.empty() ? '$' : partyPrefix.at(0));
mReturnToggles = config.getValue("ReturnToggles", "0") == "1";
mRecorder = new Recorder(this);
mParty = new Party(this, mNetwork);
@@ -195,7 +195,7 @@ void ChatWindow::chatLog(std::string line, int own, bool ignoreRecord)
lineColor = "##S";
}
- if (tmp.nick == "" && tmp.text.substr(0, 17) == "Visible GM status")
+ if (tmp.nick.empty() && tmp.text.substr(0, 17) == "Visible GM status")
{
player_node->setGM();
}
@@ -449,7 +449,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg)
msg = msg.substr(0, space);
}
- if (msg != "" && msg.at(0) == '/')
+ if (!msg.empty() && msg.at(0) == '/')
{
msg.erase(0, 1);
}
@@ -477,7 +477,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg)
mRecorder->changeRecordingStatus(msg);
else if (command == "toggle")
{
- if (msg == "")
+ if (msg.empty())
{
chatLog(mReturnToggles ? _("Return toggles chat.")
: _("Message closes chat."), BY_SERVER);
@@ -508,7 +508,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg)
}
else if (command == "party")
{
- if (msg == "")
+ if (msg.empty())
{
chatLog(_("Unknown party command... Type \"/help\" party for more "
"information."), BY_SERVER);
@@ -519,7 +519,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg)
std::string rest = (space == std::string::npos ? ""
: msg.substr(space + 1, msg.length()));
- if (rest != "")
+ if (!rest.empty())
{
msg = msg.substr(0, space);
trim(msg);
@@ -566,7 +566,7 @@ void ChatWindow::chatSend(const std::string &nick, std::string msg)
{
if ((*bi)->getType() == Being::PLAYER)
{
- if (response != "")
+ if (!response.empty())
{
response += ", ";
}
@@ -758,7 +758,7 @@ void ChatWindow::party(const std::string & command, const std::string & rest)
{
if (command == "prefix")
{
- if (rest == "")
+ if (rest.empty())
{
char temp[2] = ".";
*temp = mPartyPrefix;
@@ -789,7 +789,7 @@ void ChatWindow::party(const std::string & command, const std::string & rest)
void ChatWindow::help(const std::string & msg1, const std::string & msg2)
{
chatLog(_("-- Help --"), BY_SERVER);
- if (msg1 == "")
+ if (msg1.empty())
{
chatLog(_("/announce: Global announcement (GM only)"), BY_SERVER);
chatLog(_("/clear: Clears this window"), BY_SERVER);
diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp
index dd605be6..b9cfd789 100644
--- a/src/gui/focushandler.cpp
+++ b/src/gui/focushandler.cpp
@@ -26,7 +26,7 @@ void FocusHandler::requestModalFocus(gcn::Widget *widget)
/* If there is another widget with modal focus, remove its modal focus
* and put it on the modal widget stack.
*/
- if (mModalFocusedWidget != NULL && mModalFocusedWidget != widget)
+ if (mModalFocusedWidget && mModalFocusedWidget != widget)
{
mModalStack.push_front(mModalFocusedWidget);
mModalFocusedWidget = NULL;
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index b9fe1c90..af3b29a2 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -87,12 +87,12 @@ InventoryWindow::InventoryWindow(int invSize):
mWeightBar = new ProgressBar(1.0f, 100, 20, 0, 0, 255);
setMinHeight(130);
- setMinWidth(mWeightLabel->getWidth() + mSlotsLabel->getWidth() + 310);
+ setMinWidth(mWeightLabel->getWidth() + mSlotsLabel->getWidth() + 280);
place(0, 0, mWeightLabel).setPadding(3);
- place(1, 0, mWeightBar, 2);
- place(3, 0, mSlotsLabel).setPadding(3);
- place(4, 0, mSlotsBar, 2);
+ place(1, 0, mWeightBar, 3);
+ place(4, 0, mSlotsLabel).setPadding(3);
+ place(5, 0, mSlotsBar, 2);
place(0, 1, mInvenScroll, 7, 4);
place(5, 5, mDropButton);
place(6, 5, mUseButton);
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index df7afa48..4c117f0a 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -108,7 +108,7 @@ void ItemPopup::setItem(const ItemInfo &item)
mItemName->setWidth(boldFont->getWidth(item.getName()));
mItemDesc->setTextWrapped(item.getDescription(), 196);
mItemEffect->setTextWrapped(item.getEffect(), 196);
- mItemWeight->setTextWrapped(_("Weight: ") + toString(item.getWeight()) +
+ mItemWeight->setTextWrapped(_("Weight: ") + toString(item.getWeight()) +
_(" grams"), 196);
int minWidth = mItemName->getWidth();
@@ -136,9 +136,9 @@ void ItemPopup::setItem(const ItemInfo &item)
mItemWeightScroll->setDimension(gcn::Rectangle(2, 0, minWidth,
numRowsWeight * getFont()->getHeight()));
- if (item.getEffect() == "")
+ if (item.getEffect().empty())
{
- setContentSize(minWidth, (numRowsDesc * getFont()->getHeight() +
+ setContentSize(minWidth, (numRowsDesc * getFont()->getHeight() +
(3 * getFont()->getHeight())));
mItemWeightScroll->setPosition(2,
@@ -147,7 +147,7 @@ void ItemPopup::setItem(const ItemInfo &item)
}
else
{
- setContentSize(minWidth, (numRowsDesc * getFont()->getHeight()) +
+ setContentSize(minWidth, (numRowsDesc * getFont()->getHeight()) +
(numRowsEffect * getFont()->getHeight()) +
(3 * getFont()->getHeight()));
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 47d5a99e..90ceab1a 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -189,7 +189,7 @@ bool LoginDialog::canSubmit()
bool LoginDialog::isUShort(const std::string &str)
{
- if (str == "")
+ if (str.empty())
{
return false;
}
@@ -228,7 +228,7 @@ unsigned short LoginDialog::getUShort(const std::string &str)
void LoginDialog::DropDownList::saveEntry(const std::string &server,
const std::string &port, int &saved)
{
- if (saved < MAX_SERVER_LIST_SIZE && server != "")
+ if (saved < MAX_SERVER_LIST_SIZE && !server.empty())
{
config.setValue(mConfigPrefix + "Server" + toString(saved), server);
config.setValue(mConfigPrefix + "Port" + toString(saved), port);
@@ -247,7 +247,7 @@ LoginDialog::DropDownList::DropDownList(std::string prefix,
{
std::string server = config.getValue(mConfigPrefix + "Server" +
toString(i), "");
- if (server == "") // Just in case had original config entries
+ if (server.empty()) // Just in case had original config entries
{
server = config.getValue(mConfigPrefix + "ServerList" +
toString(i), "");
@@ -255,13 +255,13 @@ LoginDialog::DropDownList::DropDownList(std::string prefix,
std::string port = config.getValue(mConfigPrefix + "Port" +
toString(i), dfltPort.front());
- if (server != "")
+ if (!server.empty())
{
mServers.push_back(server);
mPorts.push_back(port);
}
}
- if (mServers.size() == 0)
+ if (mServers.empty())
{
mServers.assign(dflt.begin(), dflt.end());
mPorts.assign(dfltPort.begin(), dfltPort.end());
diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp
index 55cd8b5d..ccadf3e1 100644
--- a/src/gui/minimap.cpp
+++ b/src/gui/minimap.cpp
@@ -75,7 +75,7 @@ void Minimap::setMapImage(Image *img)
setMinWidth(mapWidth > titleWidth ? mapWidth : titleWidth);
setMinHeight(mapHeight);
- setMaxWidth(mMapImage->getWidth() > titleWidth ?
+ setMaxWidth(mMapImage->getWidth() > titleWidth ?
mMapImage->getWidth() + offsetX : titleWidth);
setMaxHeight(mMapImage->getHeight() + offsetY);
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index 60003fb5..f99ce6ef 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -87,7 +87,7 @@ void PlayerBox::draw(gcn::Graphics *graphics)
y = getHeight() / 2 + bs;
for (int i = 0; i < Being::VECTOREND_SPRITE; i++)
{
- if (mPlayer->getSprite(i) != NULL)
+ if (mPlayer->getSprite(i))
{
mPlayer->getSprite(i)->draw(static_cast<Graphics*>(graphics), x, y);
}
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index be5252f7..3503d0ea 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -148,7 +148,7 @@ void PopupMenu::handleLink(const std::string& link)
// Talk To action
if (link == "talk" &&
- being != NULL &&
+ being &&
being->getType() == Being::NPC &&
current_npc == 0)
{
@@ -157,7 +157,7 @@ void PopupMenu::handleLink(const std::string& link)
// Trade action
else if (link == "trade" &&
- being != NULL &&
+ being &&
being->getType() == Being::PLAYER)
{
player_node->trade(being);
@@ -166,35 +166,35 @@ void PopupMenu::handleLink(const std::string& link)
// Attack action
else if (link == "attack" &&
- being != NULL &&
+ being &&
being->getType() == Being::PLAYER)
{
player_node->attack(being, true);
}
else if (link == "unignore" &&
- being != NULL &&
+ being &&
being->getType() == Being::PLAYER)
{
player_relations.setRelation(being->getName(), PlayerRelation::NEUTRAL);
}
else if (link == "ignore" &&
- being != NULL &&
+ being &&
being->getType() == Being::PLAYER)
{
player_relations.setRelation(being->getName(), PlayerRelation::IGNORED);
}
else if (link == "disregard" &&
- being != NULL &&
+ being &&
being->getType() == Being::PLAYER)
{
player_relations.setRelation(being->getName(), PlayerRelation::DISREGARDED);
}
else if (link == "friend" &&
- being != NULL &&
+ being &&
being->getType() == Being::PLAYER)
{
player_relations.setRelation(being->getName(), PlayerRelation::FRIEND);
@@ -208,7 +208,7 @@ void PopupMenu::handleLink(const std::string& link)
/*
// Add Buddy action
- else if ((link == "buddy") && being != NULL && being->isPlayer())
+ else if ((link == "buddy") && being && being->isPlayer())
{
if (!buddyWindow->isVisible())
buddyWindow->setVisible(true);
@@ -217,7 +217,7 @@ void PopupMenu::handleLink(const std::string& link)
}*/
// Pick Up Floor Item action
- else if ((link == "pickup") && mFloorItem != NULL)
+ else if ((link == "pickup") && mFloorItem)
{
player_node->pickUp(mFloorItem);
}
@@ -257,7 +257,7 @@ void PopupMenu::handleLink(const std::string& link)
new ItemAmountWindow(AMOUNT_ITEM_DROP, inventoryWindow, mItem);
}
else if (link == "party-invite" &&
- being != NULL &&
+ being &&
being->getType() == Being::PLAYER)
{
MessageOut outMsg(player_node->getNetwork());
diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp
index de8d4d9d..c8ae2fad 100644
--- a/src/gui/radiobutton.cpp
+++ b/src/gui/radiobutton.cpp
@@ -92,7 +92,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics)
else
box = radioDisabled;
- if (box != NULL)
+ if (box)
static_cast<Graphics*>(graphics)->drawImage(box, 2, 2);
}
diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp
index 1e7d8e13..40ef974b 100644
--- a/src/gui/recorder.cpp
+++ b/src/gui/recorder.cpp
@@ -1,21 +1,21 @@
/*
- * The Mana World
- * Copyright 2004 The Mana World Development Team
+ * A chat recorder
+ * Copyright (C) 2008 Lloyd Bryant <lloyd_bryant@netzero.net>
*
* This file is part of The Mana World.
*
- * The Mana World is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
- * The Mana World is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with The Mana World; if not, write to the Free Software
+ * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
@@ -40,7 +40,7 @@ Recorder::Recorder(ChatWindow *chat, const std::string &title,
mChat = chat;
Button *button = new Button(buttonTxt, "activate", this);
- setDefaultSize(0, windowContainer->getHeight() - 123 - button->getHeight() -
+ setDefaultSize(0, windowContainer->getHeight() - 123 - button->getHeight() -
offsetY, button->getWidth() + offsetX, button->getHeight() +
offsetY);
@@ -52,6 +52,10 @@ Recorder::Recorder(ChatWindow *chat, const std::string &title,
loadWindowState();
}
+Recorder::~Recorder()
+{
+}
+
void Recorder::record(const std::string &msg)
{
if (mStream.is_open())
@@ -65,7 +69,7 @@ void Recorder::changeRecordingStatus(const std::string &msg)
std::string msgCopy = msg;
trim(msgCopy);
- if (msgCopy == "")
+ if (msgCopy.empty())
{
if (mStream.is_open())
{
@@ -94,8 +98,9 @@ void Recorder::changeRecordingStatus(const std::string &msg)
* recorded.
*/
mChat->chatLog(_("Starting to record..."), BY_SERVER);
- std::string file = std::string(PHYSFS_getUserDir()) + "/.aethyra/" + msgCopy;
-
+ const std::string file =
+ std::string(PHYSFS_getUserDir()) + "/.tmw/" + msgCopy;
+
mStream.open(file.c_str(), std::ios_base::trunc);
if (mStream.is_open())
@@ -109,7 +114,3 @@ void Recorder::action(const gcn::ActionEvent &event)
{
changeRecordingStatus("");
}
-
-Recorder::~Recorder()
-{
-}
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index cf12375c..e17f5902 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -152,7 +152,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event)
else if (event.getId() == "register" && canSubmit())
{
const std::string user = mUserField->getText();
- logger->log(_("RegisterDialog::register Username is %s"), user.c_str());
+ logger->log("RegisterDialog::register Username is %s", user.c_str());
std::string errorMsg;
int error = 0;
@@ -249,7 +249,7 @@ bool RegisterDialog::canSubmit() const
bool RegisterDialog::isUShort(const std::string &str)
{
- if (str == "")
+ if (str.empty())
{
return false;
}
diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp
index eacc4714..bc3a62dc 100644
--- a/src/gui/scrollarea.cpp
+++ b/src/gui/scrollarea.cpp
@@ -153,7 +153,7 @@ void ScrollArea::logic()
// When no scrollbar in a certain direction, adapt content size to match
// the content dimension exactly.
- if (content != NULL)
+ if (content)
{
if (getHorizontalScrollPolicy() == gcn::ScrollArea::SHOW_NEVER)
{
diff --git a/src/gui/setup_colors.cpp b/src/gui/setup_colors.cpp
index 269f8fd1..372dbd17 100644
--- a/src/gui/setup_colors.cpp
+++ b/src/gui/setup_colors.cpp
@@ -47,11 +47,11 @@ Setup_Colors::Setup_Colors() :
{
setOpaque(false);
- mcolorBox = new ListBox(textColor);
- mcolorBox->setActionEventId("color_box");
- mcolorBox->addActionListener(this);
+ mColorBox = new ListBox(textColor);
+ mColorBox->setActionEventId("color_box");
+ mColorBox->addActionListener(this);
- mScroll = new ScrollArea(mcolorBox);
+ mScroll = new ScrollArea(mColorBox);
mScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
mPreview = new BrowserBox(BrowserBox::AUTO_WRAP);
@@ -150,7 +150,7 @@ void Setup_Colors::action(const gcn::ActionEvent &event)
{
if (event.getId() == "color_box")
{
- mSelected = mcolorBox->getSelected();
+ mSelected = mColorBox->getSelected();
int col = textColor->getColorAt(mSelected);
char ch = textColor->getColorCharAt(mSelected);
std::string msg;
diff --git a/src/gui/setup_colors.h b/src/gui/setup_colors.h
index 1e56cfa8..8fd1ba59 100644
--- a/src/gui/setup_colors.h
+++ b/src/gui/setup_colors.h
@@ -48,7 +48,7 @@ class Setup_Colors : public SetupTab, public gcn::ActionListener,
void listen(const TextField *tf);
private:
- gcn::ListBox *mcolorBox;
+ gcn::ListBox *mColorBox;
gcn::ScrollArea *mScroll;
BrowserBox *mPreview;
gcn::ScrollArea *mPreviewBox;
diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp
index 5c19bd2b..d25117de 100644
--- a/src/gui/setup_players.cpp
+++ b/src/gui/setup_players.cpp
@@ -241,7 +241,7 @@ Setup_Players::Setup_Players():
mIgnoreActionChoicesBox = new DropDown(ignoreChoices, new ScrollArea(),
new ListBox(ignoreChoices), false);
- for (int i = 0; i < COLUMNS_NR; i++)
+ for (int i = 0; i < COLUMNS_NR; i++)
{
mPlayerTableTitleModel->set(0, i,
new gcn::Label(gettext(table_titles[i])));
diff --git a/src/gui/setup_players.h b/src/gui/setup_players.h
index 2edc6983..74247b77 100644
--- a/src/gui/setup_players.h
+++ b/src/gui/setup_players.h
@@ -32,8 +32,9 @@ class GuiTable;
class PlayerTableModel;
class StaticTableModel;
-class Setup_Players : public SetupTab,
- public gcn::ActionListener, public PlayerRelationsListener
+class Setup_Players : public SetupTab,
+ public gcn::ActionListener,
+ public PlayerRelationsListener
{
public:
Setup_Players();
diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp
index b1d33b09..c02025c8 100644
--- a/src/gui/setup_video.cpp
+++ b/src/gui/setup_video.cpp
@@ -89,9 +89,9 @@ ModeListModel::ModeListModel()
/* Check which modes are available */
if (modes == (SDL_Rect **)0) {
- logger->log(_("No modes available"));
+ logger->log("No modes available");
} else if (modes == (SDL_Rect **)-1) {
- logger->log(_("All resolutions available"));
+ logger->log("All resolutions available");
} else {
//logger->log("Available Modes");
for (int i = 0; modes[i]; ++i) {
diff --git a/src/gui/shortcutwindow.cpp b/src/gui/shortcutwindow.cpp
index 5d49a3c6..b6987b3e 100644
--- a/src/gui/shortcutwindow.cpp
+++ b/src/gui/shortcutwindow.cpp
@@ -50,7 +50,7 @@ ShortcutWindow::ShortcutWindow(const char *title, ShortcutContainer *content)
const int width = (int) config.getValue("screenwidth", 800);
const int height = (int) config.getValue("screenheight", 600);
- setDefaultSize(width - (mInstances * mItems->getBoxWidth()) -
+ setDefaultSize(width - (mInstances * mItems->getBoxWidth()) -
(mInstances * border), height - (mItems->getBoxHeight() *
mItems->getMaxItems()) - border, mItems->getBoxWidth() +
border, (mItems->getBoxHeight() * mItems->getMaxItems()) +
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp
index c4f8737b..03711a47 100644
--- a/src/gui/skill.cpp
+++ b/src/gui/skill.cpp
@@ -45,6 +45,11 @@ struct SkillInfo {
bool modifiable;
};
+static const SkillInfo fakeSkillInfo = {
+ _("Mystery Skill"),
+ false
+};
+
std::vector<SkillInfo> skill_db;
static void initSkillinfo();
@@ -80,11 +85,6 @@ public:
virtual void update()
{
- static const SkillInfo fakeSkillInfo = {
- _("Mystery Skill"),
- false
- };
-
mEntriesNr = mDialog->getSkills().size();
resize();
@@ -174,10 +174,18 @@ void SkillDialog::action(const gcn::ActionEvent &event)
if (selectedSkill >= 0)
player_node->raiseSkill(mSkillList[selectedSkill]->id);
}
- else if (event.getId() == "skill")
+ else if (event.getId() == "skill" && mTable->getSelectedRow() > -1)
{
- mIncButton->setEnabled(mTable->getSelectedRow() > -1 &&
- player_node->mSkillPoint > 0);
+ SKILL *skill = mSkillList[mTable->getSelectedRow()];
+ SkillInfo const *info;
+
+ if (skill->id >= 0 && (unsigned int) skill->id < skill_db.size())
+ info = &skill_db[skill->id];
+ else
+ info = &fakeSkillInfo;
+
+ mIncButton->setEnabled(player_node->mSkillPoint > 0 &&
+ info->modifiable);
}
else if (event.getId() == "close")
setVisible(false);
@@ -261,7 +269,7 @@ static void initSkillinfo()
if (!root || !xmlStrEqual(root->name, BAD_CAST "skills"))
{
- logger->log(_("Error loading skills file: %s"), SKILLS_FILE);
+ logger->log("Error loading skills file: %s", SKILLS_FILE);
skill_db.resize(2, emptySkillInfo);
skill_db[1].name = "Basic";
skill_db[1].modifiable = true;
diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp
index c76558e4..dd404a63 100644
--- a/src/gui/speechbubble.cpp
+++ b/src/gui/speechbubble.cpp
@@ -85,7 +85,7 @@ void SpeechBubble::setText(std::string mText)
width = mSpeechBox->getMinWidth();
setContentSize(width + fontHeight, (numRows * fontHeight) + 6);
- mSpeechArea->setDimension(gcn::Rectangle(4, fontHeight + 3, width + 5,
+ mSpeechArea->setDimension(gcn::Rectangle(4, fontHeight + 3, width + 5,
(numRows * fontHeight)));
}
diff --git a/src/gui/status.cpp b/src/gui/status.cpp
index 21087fad..683a9a41 100644
--- a/src/gui/status.cpp
+++ b/src/gui/status.cpp
@@ -41,7 +41,7 @@ StatusWindow::StatusWindow(LocalPlayer *player):
setWindowName(_("Status"));
setCloseButton(true);
setDefaultSize((windowContainer->getWidth() - 365) / 2,
- (windowContainer->getHeight() - 255) / 2, 400, 335);
+ (windowContainer->getHeight() - 255) / 2, 400, 345);
// ----------------------
// Status Part
@@ -119,20 +119,20 @@ StatusWindow::StatusWindow(LocalPlayer *player):
place(0, 0, mLvlLabel, 3);
place(5, 0, mJobLvlLabel, 3);
place(8, 0, mGpLabel, 3);
- place(1, 1, mHpLabel);
+ place(1, 1, mHpLabel).setPadding(3);
place(2, 1, mHpBar, 3);
- place(6, 1, mXpLabel);
+ place(6, 1, mXpLabel).setPadding(3);
place(7, 1, mXpBar, 3);
- place(1, 2, mMpLabel);
+ place(1, 2, mMpLabel).setPadding(3);
place(2, 2, mMpBar, 3);
- place(6, 2, mJobLabel);
+ place(6, 2, mJobLabel).setPadding(3);
place(7, 2, mJobBar, 3);
place.getCell().matchColWidth(0, 1);
place = getPlacer(0, 3);
place(0, 0, mStatsTitleLabel, 5);
place(5, 1, mStatsTotalLabel, 5);
place(12, 1, mStatsCostLabel, 5);
- for(int i = 0; i < 6; i++)
+ for (int i = 0; i < 6; i++)
{
place(0, 2 + i, mStatsLabel[i], 7).setPadding(5);
place(7, 2 + i, mStatsDisplayLabel[i]).setPadding(5);
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index 1ee9da0f..8dd546d9 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -185,7 +185,7 @@ int GuiTable::getColumnWidth(int i)
void GuiTable::setSelectedRow(int selected)
{
- if (mModel == NULL)
+ if (!mModel)
{
mSelectedRow = -1;
}
@@ -213,7 +213,7 @@ void GuiTable::setSelectedRow(int selected)
void GuiTable::setSelectedColumn(int selected)
{
- if (mModel == NULL)
+ if (!mModel)
{
mSelectedColumn = -1;
}
diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp
index 66855b77..8e6636df 100644
--- a/src/gui/truetypefont.cpp
+++ b/src/gui/truetypefont.cpp
@@ -91,7 +91,7 @@ TrueTypeFont::TrueTypeFont(const std::string &filename, int size)
++fontCounter;
mFont = TTF_OpenFont(filename.c_str(), size);
- if (mFont == NULL)
+ if (!mFont)
{
throw GCN_EXCEPTION("SDLTrueTypeFont::SDLTrueTypeFont: " +
std::string(TTF_GetError()));
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index 1f62bd2d..b3861b27 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -75,7 +75,7 @@ std::vector<std::string> loadTextFile(const std::string &fileName)
std::ifstream fin(fileName.c_str());
if (!fin) {
- logger->log(_("Couldn't load text file: %s"), fileName.c_str());
+ logger->log("Couldn't load text file: %s", fileName.c_str());
return lines;
}
@@ -193,7 +193,7 @@ void UpdaterWindow::loadNews()
{
if (!mMemoryBuffer)
{
- logger->log(_("Couldn't load news"));
+ logger->log("Couldn't load news");
return;
}
@@ -205,7 +205,7 @@ void UpdaterWindow::loadNews()
// Tokenize and add each line separately
char *line = strtok(mMemoryBuffer, "\n");
- while (line != NULL)
+ while (line)
{
mBrowserBox->addRow(line);
line = strtok(NULL, "\n");
@@ -408,9 +408,9 @@ void UpdaterWindow::download()
mDownloadComplete = false;
mThread = SDL_CreateThread(UpdaterWindow::downloadThread, this);
- if (mThread == NULL)
+ if (!mThread)
{
- logger->log(_("Unable to create mThread"));
+ logger->log("Unable to create mThread");
mDownloadStatus = UPDATE_ERROR;
}
}
@@ -504,7 +504,7 @@ void UpdaterWindow::logic()
}
else
{
- logger->log(_("%s already here"), mCurrentFile.c_str());
+ logger->log("%s already here", mCurrentFile.c_str());
}
mLineIndex++;
}
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index 22e952e7..21402c89 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -51,10 +51,10 @@ struct TabData
};
static TabData const data[TAB_COUNT] = {
- {"graphics/gui/tab.png", 0, 0},
- {"graphics/gui/tab.png", 9, 4},
- {"graphics/gui/tabselected.png", 16, 19},
- {"graphics/gui/tab.png", 25, 23}
+ { "graphics/gui/tab.png", 0, 0 },
+ { "graphics/gui/tab.png", 9, 4 },
+ { "graphics/gui/tabselected.png", 16, 19 },
+ { "graphics/gui/tab.png", 25, 23 }
};
ImageRect Tab::tabImg[TAB_COUNT];
@@ -117,7 +117,7 @@ void Tab::draw(gcn::Graphics *graphics)
// check which type of tab to draw
if (mTabbedArea)
{
- if(mTabbedArea->isTabSelected(this))
+ if (mTabbedArea->isTabSelected(this))
{
mode = TAB_SELECTED;
// if tab is selected, it doesnt need to highlight activity
diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp
index c4e22bff..5ff7c4bc 100644
--- a/src/gui/widgets/tabbedarea.cpp
+++ b/src/gui/widgets/tabbedarea.cpp
@@ -90,7 +90,7 @@ void TabbedArea::addTab(Tab *tab, gcn::Widget *widget)
mTabContainer->add(tab);
mTabs.push_back(std::pair<Tab*, gcn::Widget*>(tab, widget));
- if (mSelectedTab == NULL)
+ if (!mSelectedTab)
{
setSelectedTab(tab);
}
diff --git a/src/joystick.h b/src/joystick.h
index 4e5c3d23..4c5390c2 100644
--- a/src/joystick.h
+++ b/src/joystick.h
@@ -31,7 +31,7 @@ class Joystick
* Number of buttons we can handle.
*/
enum
- {
+ {
MAX_BUTTONS = 6
};
diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp
index 413a8036..5a0c0678 100644
--- a/src/keyboardconfig.cpp
+++ b/src/keyboardconfig.cpp
@@ -150,11 +150,11 @@ bool KeyboardConfig::hasConflicts()
for (j = i, j++; j < KEY_TOTAL; j++)
{
// Allow for item shortcut and emote keys to overlap, but no other keys
- if (!((((i >= KEY_SHORTCUT_1) && (i <= KEY_SHORTCUT_12)) &&
- ((j >= KEY_EMOTE_1) && (j <= KEY_EMOTE_12))) ||
+ if (!((((i >= KEY_SHORTCUT_1) && (i <= KEY_SHORTCUT_12)) &&
+ ((j >= KEY_EMOTE_1) && (j <= KEY_EMOTE_12))) ||
((i == KEY_TOGGLE_CHAT) && (j == KEY_OK))) &&
(mKey[i].value == mKey[j].value)
- )
+ )
{
return true;
}
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index b450c0ba..a02a8b1b 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -343,7 +343,7 @@ void LocalPlayer::setTarget(Being *target)
return;
mLastTarget = tick_time;
- if ((target == NULL) || target == mTarget)
+ if (!target || target == mTarget)
{
target = NULL;
mKeepAttacking = false;
@@ -538,7 +538,8 @@ void LocalPlayer::attack(Being *target, bool keep)
if (mEquippedWeapon)
{
std::string soundFile = mEquippedWeapon->getSound(EQUIP_EVENT_STRIKE);
- if (soundFile != "") sound.playSfx(soundFile);
+ if (!soundFile.empty())
+ sound.playSfx(soundFile);
}
else {
sound.playSfx("sfx/fist-swish.ogg");
diff --git a/src/main.cpp b/src/main.cpp
index 42f73eef..aa8e2805 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -207,14 +207,14 @@ void setUpdatesDir()
}
else
{
- logger->log(_("Error: Invalid update host: %s"), updateHost.c_str());
+ logger->log("Error: Invalid update host: %s", updateHost.c_str());
errorMessage = _("Invalid update host: ") + updateHost;
state = ERROR_STATE;
}
}
else
{
- logger->log(_("Warning: no protocol was specified for the update host"));
+ logger->log("Warning: no protocol was specified for the update host");
updates << "updates/" << updateHost << "/" << loginData.port;
updatesDir = updates.str();
}
@@ -239,14 +239,14 @@ void setUpdatesDir()
if (!CreateDirectory(newDir.c_str(), 0) &&
GetLastError() != ERROR_ALREADY_EXISTS)
{
- logger->log(_("Error: %s can't be made, but doesn't exist!"),
- newDir.c_str());
+ logger->log("Error: %s can't be made, but doesn't exist!",
+ newDir.c_str());
errorMessage = _("Error creating updates directory!");
state = ERROR_STATE;
}
#else
- logger->log(_("Error: %s/%s can't be made, but doesn't exist!"),
- homeDir.c_str(), updatesDir.c_str());
+ logger->log("Error: %s/%s can't be made, but doesn't exist!",
+ homeDir.c_str(), updatesDir.c_str());
errorMessage = _("Error creating updates directory!");
state = ERROR_STATE;
#endif
@@ -285,13 +285,13 @@ void init_engine(const Options &options)
logger->setLogFile(homeDir + std::string("/tmw.log"));
#ifdef PACKAGE_VERSION
- logger->log(_("Starting The Mana World Version %s"), PACKAGE_VERSION);
+ logger->log("Starting The Mana World Version %s", PACKAGE_VERSION);
#else
- logger->log(_("Starting The Mana World - Version not defined"));
+ logger->log("Starting The Mana World - Version not defined");
#endif
// Initialize SDL
- logger->log(_("Initializing SDL..."));
+ logger->log("Initializing SDL...");
if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) {
std::cerr << _("Could not initialize SDL: ") <<
SDL_GetError() << std::endl;
@@ -332,11 +332,11 @@ void init_engine(const Options &options)
strncat(path, "/data", PATH_MAX - 1);
resman->addToSearchPath(path, true);
#else
- resman->addToSearchPath(TMW_DATADIR "data", true);
+ resman->addToSearchPath(PKG_DATADIR "data", true);
#endif
// Fill configuration with defaults
- logger->log(_("Initializing configuration..."));
+ logger->log("Initializing configuration...");
config.setValue("host", "www.themanaworld.org");
config.setValue("port", 6901);
config.setValue("hwaccel", 0);
@@ -389,7 +389,7 @@ void init_engine(const Options &options)
SetClassLong(pInfo.window, GCL_HICON, (LONG) icon);
}
#else
- SDL_Surface *icon = IMG_Load(TMW_DATADIR "data/icons/tmw.png");
+ SDL_Surface *icon = IMG_Load(PKG_DATADIR "data/icons/tmw.png");
if (icon)
{
SDL_SetAlpha(icon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE);
@@ -450,7 +450,7 @@ void init_engine(const Options &options)
catch (const char *err) {
state = ERROR_STATE;
errorMessage = err;
- logger->log(_("Warning: %s"), err);
+ logger->log("Warning: %s", err);
}
// Initialize keyboard
@@ -608,8 +608,8 @@ struct ErrorListener : public gcn::ActionListener
// TODO Find some nice place for these functions
void accountLogin(Network *network, LoginData *loginData)
{
- logger->log(_("Trying to connect to account server..."));
- logger->log(_("Username is %s"), loginData->username.c_str());
+ logger->log("Trying to connect to account server...");
+ logger->log("Username is %s", loginData->username.c_str());
network->connect(loginData->hostname, loginData->port);
network->registerHandler(&loginHandler);
loginHandler.setLoginData(loginData);
@@ -658,7 +658,7 @@ static void positionDialog(Window *dialog, int screenWidth, int screenHeight)
void charLogin(Network *network, LoginData *loginData)
{
- logger->log(_("Trying to connect to char server..."));
+ logger->log("Trying to connect to char server...");
network->connect(loginData->hostname, loginData->port);
network->registerHandler(&charServerHandler);
charServerHandler.setCharInfo(&charInfo);
@@ -680,14 +680,14 @@ void charLogin(Network *network, LoginData *loginData)
void mapLogin(Network *network, LoginData *loginData)
{
- logger->log(_("Memorizing selected character %s"),
+ logger->log("Memorizing selected character %s",
player_node->getName().c_str());
config.setValue("lastCharacter", player_node->getName());
MessageOut outMsg(network);
- logger->log(_("Trying to connect to map server..."));
- logger->log(_("Map: %s"), map_path.c_str());
+ logger->log("Trying to connect to map server...");
+ logger->log("Map: %s", map_path.c_str());
network->connect(loginData->hostname, loginData->port);
network->registerHandler(&mapLoginHandler);
@@ -823,7 +823,7 @@ int main(int argc, char *argv[])
login_wallpaper = ResourceManager::getInstance()->getImage(wallpaperName);
if (!login_wallpaper)
- logger->log(_("Couldn't load %s as wallpaper"), wallpaperName.c_str());
+ logger->log("Couldn't load %s as wallpaper", wallpaperName.c_str());
while (state != EXIT_STATE)
{
@@ -974,7 +974,8 @@ int main(int argc, char *argv[])
nextState);
positionDialog(currentDialog, screenWidth,
screenHeight);
- if (options.chooseDefault || options.playername != "")
+ if (options.chooseDefault
+ || !options.playername.empty())
{
((ServerSelectDialog*) currentDialog)->action(
gcn::ActionEvent(NULL, "ok"));
diff --git a/src/main.h b/src/main.h
index 0e884fb2..5a337d15 100644
--- a/src/main.h
+++ b/src/main.h
@@ -30,8 +30,8 @@
#include "winver.h"
#endif
-#ifndef TMW_DATADIR
-#define TMW_DATADIR ""
+#ifndef PKG_DATADIR
+#define PKG_DATADIR ""
#endif
/*
diff --git a/src/monster.cpp b/src/monster.cpp
index 3b1e4c80..8f56560b 100644
--- a/src/monster.cpp
+++ b/src/monster.cpp
@@ -124,7 +124,7 @@ void Monster::setAction(Action action)
//attack particle effect
particleEffect = getInfo().getAttackParticleEffect();
- if (particleEffect != "" && mParticleEffects)
+ if (!particleEffect.empty() && mParticleEffects)
{
switch (mDirection)
{
diff --git a/src/net/partyhandler.cpp b/src/net/partyhandler.cpp
index 03aca66d..fe7db55d 100644
--- a/src/net/partyhandler.cpp
+++ b/src/net/partyhandler.cpp
@@ -69,7 +69,7 @@ void PartyHandler::handleMessage(MessageIn *msg)
{
int id = msg->readInt32();
Being *being = beingManager->findBeing(id);
- if (being == NULL)
+ if (!being)
{
break;
}
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index 46ded32e..470a4aa4 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -191,9 +191,9 @@ void PlayerHandler::handleMessage(MessageIn *msg)
player_node->mMaxWeight / 2)
{
weightNotice = new OkDialog(_("Message"),
- _("You are carrying more then half "
- "your weight. You are unable to "
- "regain health."));
+ _("You are carrying more then "
+ "half your weight. You are "
+ "unable to regain health."));
weightNotice->addActionListener(
&weightListener);
}
@@ -391,7 +391,7 @@ void PlayerHandler::handleMessage(MessageIn *msg)
BY_SERVER);
break;
default:
- logger->log(_("0x013b: Unhandled message %i"), type);
+ logger->log("0x013b: Unhandled message %i", type);
break;
}
}
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index fa5dcde4..25e6ade5 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -41,7 +41,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
mMap = map;
mParticleTarget = target;
- //initializing default values
+ // Initializing default values
mParticlePosX.set(0.0f);
mParticlePosY.set(0.0f);
mParticlePosZ.set(0.0f);
@@ -91,7 +91,7 @@ ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *
{
std::string image = XML::getProperty(propertyNode, "value", "");
// Don't leak when multiple images are defined
- if (image != "" && !mParticleImage)
+ if (!image.empty() && !mParticleImage)
{
ResourceManager *resman = ResourceManager::getInstance();
mParticleImage = resman->getImage(image);
diff --git a/src/party.cpp b/src/party.cpp
index fe575a37..589aa9b1 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -67,7 +67,7 @@ void Party::respond(const std::string &command, const std::string &args)
void Party::create(const std::string &party)
{
- if (party == "")
+ if (party.empty())
{
mChat->chatLog(_("Party name is missing."), BY_SERVER);
return;
@@ -122,7 +122,7 @@ void Party::invitedAsk(const std::string &nick, int gender,
const std::string &partyName)
{
mPartyName = partyName; /* Quick and nasty - needs redoing */
- if (nick == "")
+ if (nick.empty())
{
mChat->chatLog(_("You can\'t have a blank party name!"), BY_SERVER);
return;
@@ -153,7 +153,7 @@ void Party::leftResponse(const std::string &nick)
void Party::receiveChat(Being *being, const std::string &msg)
{
- if (being == NULL)
+ if (!being)
{
return;
}
@@ -169,7 +169,7 @@ void Party::receiveChat(Being *being, const std::string &msg)
void Party::help(const std::string &msg)
{
- if (msg == "")
+ if (msg.empty())
{
mChat->chatLog(_("Command: /party <command> <args>"), BY_SERVER);
mChat->chatLog(_("where <command> can be one of:"), BY_SERVER);
diff --git a/src/player.cpp b/src/player.cpp
index 610dfeb1..a2a263b3 100644
--- a/src/player.cpp
+++ b/src/player.cpp
@@ -169,11 +169,12 @@ void Player::setSprite(int slot, int id, std::string color)
std::string filename = ItemDB::get(id).getSprite(mGender);
AnimatedSprite *equipmentSprite = NULL;
- if (filename != "")
+ if (!filename.empty())
{
- if (color!="") filename += "|" + color;
+ if (!color.empty())
+ filename += "|" + color;
equipmentSprite = AnimatedSprite::load(
- "graphics/sprites/" + filename);
+ "graphics/sprites/" + filename);
}
if (equipmentSprite)
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index aa83115c..c82876e1 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -58,7 +58,7 @@ class PlayerConfSerialiser : public ConfigurationListManager<std::pair<std::stri
std::map<std::string, PlayerRelation *> *container)
{
std::string name = cobj->getValue(NAME, "");
- if (name == "")
+ if (name.empty())
return container;
if (!(*container)[name]) {
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index 61ea4bc0..3a8754ea 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -1,22 +1,22 @@
/*
- * Aethyra
- * Copyright 2008 Aethyra Development Team
+ * Color database
+ * Copyright (C) 2008 Aethyra Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
- * Aethyra is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
- * Aethyra is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Aethyra; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <libxml/tree.h>
@@ -25,7 +25,6 @@
#include "../log.h"
-#include "../utils/gettext.h"
#include "../utils/xml.h"
#define HAIR_COLOR_FILE "colors.xml"
@@ -51,7 +50,7 @@ void ColorDB::load()
if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
{
- logger->log(_("Trying TMW's color file, %s."), TMW_COLOR_FILE);
+ logger->log("Trying TMW's color file, %s.", TMW_COLOR_FILE);
TMWHair = true;
@@ -61,7 +60,7 @@ void ColorDB::load()
root = doc->rootNode();
if (!root || !xmlStrEqual(root->name, BAD_CAST "colors"))
{
- logger->log(_("ColorDB: Failed"));
+ logger->log("ColorDB: Failed");
mColors[0] = mFail;
mLoaded = true;
@@ -78,7 +77,7 @@ void ColorDB::load()
if (mColors.find(id) != mColors.end())
{
- logger->log(_("ColorDB: Redefinition of dye ID %d"), id);
+ logger->log("ColorDB: Redefinition of dye ID %d", id);
}
TMWHair ? mColors[id] = XML::getProperty(node, "value", "#FFFFFF") :
@@ -93,7 +92,7 @@ void ColorDB::load()
void ColorDB::unload()
{
- logger->log(_("Unloading color database..."));
+ logger->log("Unloading color database...");
mColors.clear();
mLoaded = false;
@@ -108,7 +107,7 @@ std::string& ColorDB::get(int id)
if (i == mColors.end())
{
- logger->log(_("ColorDB: Error, unknown dye ID# %d"), id);
+ logger->log("ColorDB: Error, unknown dye ID# %d", id);
return mFail;
}
else
diff --git a/src/resources/colordb.h b/src/resources/colordb.h
index 892411f8..c581f653 100644
--- a/src/resources/colordb.h
+++ b/src/resources/colordb.h
@@ -1,22 +1,22 @@
/*
- * Aethyra
- * Copyright 2008 Aethyra Development Team
+ * Color database
+ * Copyright (C) 2008 Aethyra Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
- * Aethyra is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
- * Aethyra is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Aethyra; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef COLOR_MANAGER_H
diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp
index ac41b59c..77c3c2fb 100644
--- a/src/resources/emotedb.cpp
+++ b/src/resources/emotedb.cpp
@@ -1,29 +1,28 @@
/*
- * Aethyra
- * Copyright 2009 Aethyra Development Team
+ * Emote database
+ * Copyright (C) 2008 Aethyra Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
- * Aethyra is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
- * Aethyra is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Aethyra; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "emotedb.h"
#include "../log.h"
-#include "../utils/gettext.h"
#include "../utils/xml.h"
namespace
@@ -47,14 +46,14 @@ void EmoteDB::load()
unknownSprite->variant = 0;
mUnknown.sprites.push_back(unknownSprite);
- logger->log(_("Initializing emote database..."));
+ logger->log("Initializing emote database...");
XML::Document doc("emotes.xml");
xmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "emotes"))
{
- logger->log(_("Emote Database: Error while loading emotes.xml!"));
+ logger->log("Emote Database: Error while loading emotes.xml!");
return;
}
@@ -67,7 +66,7 @@ void EmoteDB::load()
int id = XML::getProperty(emoteNode, "id", -1);
if (id == -1)
{
- logger->log(_("Emote Database: Emote with missing ID in emotes.xml!"));
+ logger->log("Emote Database: Emote with missing ID in emotes.xml!");
continue;
}
@@ -126,7 +125,7 @@ const EmoteInfo& EmoteDB::get(int id)
if (i == mEmoteInfos.end())
{
- logger->log(_("EmoteDB: Warning, unknown emote ID %d requested"), id);
+ logger->log("EmoteDB: Warning, unknown emote ID %d requested", id);
return mUnknown;
}
else
diff --git a/src/resources/emotedb.h b/src/resources/emotedb.h
index 2b9dbbc2..2cf3af62 100644
--- a/src/resources/emotedb.h
+++ b/src/resources/emotedb.h
@@ -1,22 +1,22 @@
/*
- * Aethyra
- * Copyright 2009 Aethyra Development Team
+ * Emote database
+ * Copyright (C) 2008 Aethyra Development Team
*
- * This file is part of Aethyra.
+ * This file is part of The Mana World.
*
- * Aethyra is free software; you can redistribute it and/or modify
+ * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* any later version.
*
- * Aethyra is distributed in the hope that it will be useful,
+ * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with Aethyra; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef EMOTE_DB_H
diff --git a/src/resources/image.h b/src/resources/image.h
index 9af10fda..fe3081ac 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -94,12 +94,6 @@ class Image : public Resource
virtual void unload();
/**
- * Returns the image.
- */
- virtual const Image* getImage() const
- { return this; }
-
- /**
* Returns the width of the image.
*/
virtual int getWidth() const
@@ -189,12 +183,6 @@ class SubImage : public Image
~SubImage();
/**
- * Returns the image.
- */
- virtual const Image* getImage() const
- { return mParent; }
-
- /**
* Creates a new image with the desired clipping rectangle.
*
* @return <code>NULL</code> if creation failed and a valid
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 9976f0d4..6fa010d4 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -49,7 +49,7 @@ void ItemDB::load()
if (mLoaded)
return;
- logger->log(_("Initializing item database..."));
+ logger->log("Initializing item database...");
mUnknown = new ItemInfo();
mUnknown->setName(_("Unknown item"));
@@ -74,12 +74,12 @@ void ItemDB::load()
if (id == 0)
{
- logger->log(_("ItemDB: Invalid or missing item ID in items.xml!"));
+ logger->log("ItemDB: Invalid or missing item ID in items.xml!");
continue;
}
else if (mItemInfos.find(id) != mItemInfos.end())
{
- logger->log(_("ItemDB: Redefinition of item ID %d"), id);
+ logger->log("ItemDB: Redefinition of item ID %d", id);
}
std::string type = XML::getProperty(node, "type", "other");
@@ -135,7 +135,7 @@ void ItemDB::load()
}
else
{
- logger->log(_("ItemDB: Duplicate name of item found item %d"),
+ logger->log("ItemDB: Duplicate name of item found item %d",
id);
}
}
@@ -161,7 +161,7 @@ void ItemDB::load()
void ItemDB::unload()
{
- logger->log(_("Unloading item database..."));
+ logger->log("Unloading item database...");
delete mUnknown;
mUnknown = NULL;
@@ -179,7 +179,7 @@ const ItemInfo& ItemDB::get(int id)
if (i == mItemInfos.end())
{
- logger->log(_("ItemDB: Error, unknown item ID# %d"), id);
+ logger->log("ItemDB: Error, unknown item ID# %d", id);
return *mUnknown;
}
else
@@ -235,7 +235,7 @@ void loadSoundRef(ItemInfo *itemInfo, xmlNodePtr node)
}
else
{
- logger->log(_("ItemDB: Ignoring unknown sound event '%s'"),
+ logger->log("ItemDB: Ignoring unknown sound event '%s'",
event.c_str());
}
}
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index c7824a5d..15451c95 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -43,7 +43,7 @@ void MonsterDB::load()
mUnknown.addSprite("error.xml");
mUnknown.setName(_("unnamed"));
- logger->log(_("Initializing monster database..."));
+ logger->log("Initializing monster database...");
XML::Document doc(_("monsters.xml"));
xmlNodePtr rootNode = doc.rootNode();
@@ -81,7 +81,8 @@ void MonsterDB::load()
}
else
{
- logger->log(_("MonsterDB: Unknown target cursor type \"%s\" for %s - using medium sized one"),
+ logger->log("MonsterDB: Unknown target cursor type \"%s\" for %s -"
+ "using medium sized one",
targetCursor.c_str(), currentInfo->getName().c_str());
currentInfo->setTargetCursorSize(Being::TC_MEDIUM);
}
@@ -91,7 +92,8 @@ void MonsterDB::load()
{
if (xmlStrEqual(spriteNode->name, BAD_CAST "sprite"))
{
- currentInfo->addSprite((const char*) spriteNode->xmlChildrenNode->content);
+ currentInfo->addSprite(
+ (const char*) spriteNode->xmlChildrenNode->content);
}
if (xmlStrEqual(spriteNode->name, BAD_CAST "sound"))
@@ -118,14 +120,17 @@ void MonsterDB::load()
}
else
{
- logger->log(_("MonsterDB: Warning, sound effect %s for unknown event %s of monster %s"),
- filename, event.c_str(), currentInfo->getName().c_str());
+ logger->log("MonsterDB: Warning, sound effect %s for "
+ "unknown event %s of monster %s",
+ filename, event.c_str(),
+ currentInfo->getName().c_str());
}
}
if (xmlStrEqual(spriteNode->name, BAD_CAST "attack"))
{
- std::string event = XML::getProperty(spriteNode, "particle-effect", "");
+ std::string event = XML::getProperty(
+ spriteNode, "particle-effect", "");
currentInfo->addAttackParticleEffect(event);
}
@@ -156,7 +161,7 @@ const MonsterInfo &MonsterDB::get(int id)
if (i == mMonsterInfos.end())
{
- logger->log(_("MonsterDB: Warning, unknown monster ID %d requested"), id);
+ logger->log("MonsterDB: Warning, unknown monster ID %d requested", id);
return mUnknown;
}
else
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index 73c3939d..ee65136a 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -43,7 +43,7 @@ void NPCDB::load()
unknownSprite->variant = 0;
mUnknown.sprites.push_back(unknownSprite);
- logger->log(_("Initializing NPC database..."));
+ logger->log("Initializing NPC database...");
XML::Document doc("npcs.xml");
xmlNodePtr rootNode = doc.rootNode();
@@ -62,7 +62,7 @@ void NPCDB::load()
int id = XML::getProperty(npcNode, "id", 0);
if (id == 0)
{
- logger->log(_("NPC Database: NPC with missing ID in npcs.xml!"));
+ logger->log("NPC Database: NPC with missing ID in npcs.xml!");
continue;
}
@@ -120,7 +120,7 @@ const NPCInfo& NPCDB::get(int id)
if (i == mNPCInfos.end())
{
- logger->log(_("NPCDB: Warning, unknown NPC ID %d requested"), id);
+ logger->log("NPCDB: Warning, unknown NPC ID %d requested", id);
return mUnknown;
}
else
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index 3f58076e..fa8f4654 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -159,7 +159,7 @@ void ResourceManager::searchAndAddArchives(const std::string &path,
const char *dirSep = PHYSFS_getDirSeparator();
char **list = PHYSFS_enumerateFiles(path.c_str());
- for (char **i = list; *i != NULL; i++)
+ for (char **i = list; *i; i++)
{
size_t len = strlen(*i);
@@ -207,7 +207,7 @@ std::string ResourceManager::getPath(const std::string &file)
else
{
// if not found in search path return the default path
- path = std::string(TMW_DATADIR) + std::string("data") + "/" + file;
+ path = std::string(PKG_DATADIR) + std::string("data") + "/" + file;
}
return path;
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index af3281be..20c79e73 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -321,7 +321,7 @@ SpriteDef::~SpriteDef()
SpriteAction SpriteDef::makeSpriteAction(const std::string &action)
{
- if (action == "" || action == "default") {
+ if (action.empty() || action == "default") {
return ACTION_DEFAULT;
}
if (action == "stand") {
@@ -373,7 +373,7 @@ SpriteAction SpriteDef::makeSpriteAction(const std::string &action)
SpriteDirection SpriteDef::makeSpriteDirection(const std::string& direction)
{
- if (direction == "" || direction == "default") {
+ if (direction.empty() || direction == "default") {
return DIRECTION_DEFAULT;
}
else if (direction == "up") {
diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp
index d90602a6..48f2f6a5 100644
--- a/src/simpleanimation.cpp
+++ b/src/simpleanimation.cpp
@@ -49,7 +49,7 @@ SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode):
// Get animation frames
for ( xmlNodePtr frameNode = animationNode->xmlChildrenNode;
- frameNode != NULL;
+ frameNode;
frameNode = frameNode->next)
{
int delay = XML::getProperty(frameNode, "delay", 0);
diff --git a/src/sound.cpp b/src/sound.cpp
index 78538c09..6e0b0da0 100644
--- a/src/sound.cpp
+++ b/src/sound.cpp
@@ -128,7 +128,7 @@ void Sound::playMusic(const std::string &filename, int loop)
{
if (!mInstalled) return;
- if (mMusic != NULL) {
+ if (mMusic) {
stopMusic();
}
@@ -154,7 +154,7 @@ void Sound::stopMusic()
logger->log("Sound::stopMusic()");
- if (mMusic != NULL) {
+ if (mMusic) {
Mix_HaltMusic();
Mix_FreeMusic(mMusic);
mMusic = NULL;
@@ -165,7 +165,7 @@ void Sound::fadeInMusic(const std::string &path, int loop, int ms)
{
if (!mInstalled) return;
- if (mMusic != NULL) {
+ if (mMusic) {
stopMusic();
}
@@ -188,7 +188,7 @@ void Sound::fadeOutMusic(int ms)
logger->log("Sound::fadeOutMusic() Fading-out (%i ms)", ms);
- if (mMusic != NULL) {
+ if (mMusic) {
Mix_FadeOutMusic(ms);
Mix_FreeMusic(mMusic);
mMusic = NULL;
diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp
index 8872fd7b..7a50e794 100644
--- a/src/statuseffect.cpp
+++ b/src/statuseffect.cpp
@@ -39,19 +39,19 @@ StatusEffect::~StatusEffect()
void StatusEffect::playSFX()
{
- if (mSFXEffect != "")
+ if (!mSFXEffect.empty())
sound.playSfx(mSFXEffect);
}
void StatusEffect::deliverMessage()
{
- if (mMessage != "")
+ if (!mMessage.empty())
chatWindow->chatLog(mMessage, BY_SERVER);
}
Particle *StatusEffect::getParticle()
{
- if (mParticleEffect == "")
+ if (mParticleEffect.empty())
return NULL;
else
return particleEngine->addEffect(mParticleEffect, 0, 0);
@@ -59,7 +59,7 @@ Particle *StatusEffect::getParticle()
AnimatedSprite *StatusEffect::getIcon()
{
- if (mIcon == "")
+ if (mIcon.empty())
return NULL;
else {
AnimatedSprite *sprite = AnimatedSprite::load(
@@ -74,7 +74,7 @@ AnimatedSprite *StatusEffect::getIcon()
SpriteAction StatusEffect::getAction()
{
- if (mAction == "")
+ if (mAction.empty())
return ACTION_INVALID;
else
return SpriteDef::makeSpriteAction(mAction);
diff --git a/src/text.cpp b/src/text.cpp
index 5d88bd69..c4559879 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -39,7 +39,7 @@ Text::Text(const std::string &text, int x, int y,
gcn::Graphics::Alignment alignment,
gcn::Color color, bool isSpeech) :
mText(text),
- mcolor(color),
+ mColor(color),
mIsSpeech(isSpeech)
{
if (textManager == 0)
@@ -161,7 +161,7 @@ void Text::draw(gcn::Graphics *graphics, int xOff, int yOff)
gcn::Graphics::LEFT);
}
- graphics->setColor(mcolor);
+ graphics->setColor(mColor);
graphics->drawText(mText, mX - xOff, mY - yOff,
gcn::Graphics::LEFT);
}
diff --git a/src/text.h b/src/text.h
index 550c00a5..6e121da7 100644
--- a/src/text.h
+++ b/src/text.h
@@ -65,7 +65,7 @@ class Text
int mXOffset; /**< The offset of mX from the desired x. */
static int mInstances; /**< Instances of text. */
std::string mText; /**< The text to display. */
- gcn::Color mcolor; /**< The color of the text. */
+ gcn::Color mColor; /**< The color of the text. */
bool mIsSpeech; /**< Is this text a speech bubble? */
protected: