summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/animatedsprite.h24
-rw-r--r--src/being.cpp3
-rw-r--r--src/configuration.cpp2
-rw-r--r--src/equipment.cpp3
-rw-r--r--src/floor_item.h18
-rw-r--r--src/graphics.cpp18
-rw-r--r--src/graphics.h20
-rw-r--r--src/gui/browserbox.cpp9
-rw-r--r--src/gui/button.cpp3
-rw-r--r--src/gui/buttonbox.cpp3
-rw-r--r--src/gui/buttonbox.h3
-rw-r--r--src/gui/char_select.cpp12
-rw-r--r--src/gui/char_server.cpp9
-rw-r--r--src/gui/chat.h265
-rw-r--r--src/gui/debugwindow.cpp3
-rw-r--r--src/gui/emotecontainer.h14
-rw-r--r--src/gui/emotewindow.h1
-rw-r--r--src/gui/inttextbox.cpp3
-rw-r--r--src/gui/inttextbox.h3
-rw-r--r--src/gui/itempopup.cpp113
-rw-r--r--src/gui/itempopup.h51
-rw-r--r--src/gui/listbox.cpp3
-rw-r--r--src/gui/login.cpp29
-rw-r--r--src/gui/login.h9
-rw-r--r--src/gui/passwordfield.h3
-rw-r--r--src/gui/playerbox.cpp6
-rw-r--r--src/gui/playerbox.h3
-rw-r--r--src/gui/progressbar.cpp9
-rw-r--r--src/gui/progressbar.h24
-rw-r--r--src/gui/register.cpp21
-rw-r--r--src/gui/register.h9
-rw-r--r--src/gui/setup_video.h11
-rw-r--r--src/gui/status.h1
-rw-r--r--src/gui/table.cpp84
-rw-r--r--src/gui/table_model.cpp39
-rw-r--r--src/gui/truetypefont.cpp11
-rw-r--r--src/gui/truetypefont.h2
-rw-r--r--src/gui/updatewindow.cpp6
-rw-r--r--src/gui/viewport.cpp2
-rw-r--r--src/gui/widgets/resizegrip.cpp3
-rw-r--r--src/gui/window.h9
-rw-r--r--src/item.h36
-rw-r--r--src/map.h26
-rw-r--r--src/monster.h3
-rw-r--r--src/net/messagein.cpp21
-rw-r--r--src/net/messagein.h20
-rw-r--r--src/net/network.cpp3
-rw-r--r--src/net/network.h54
-rw-r--r--src/net/partyhandler.cpp3
-rw-r--r--src/net/playerhandler.cpp2
-rw-r--r--src/net/tradehandler.cpp38
-rw-r--r--src/npc.cpp15
-rw-r--r--src/particlecontainer.cpp21
-rw-r--r--src/particleemitter.cpp3
-rw-r--r--src/particleemitter.h3
-rw-r--r--src/player_relations.cpp57
-rw-r--r--src/properties.h9
-rw-r--r--src/resources/action.h6
-rw-r--r--src/resources/animation.cpp9
-rw-r--r--src/resources/animation.h18
-rw-r--r--src/resources/buddylist.cpp2
-rw-r--r--src/resources/buddylist.h2
-rw-r--r--src/resources/colordb.cpp11
-rw-r--r--src/resources/image.h29
-rw-r--r--src/resources/imagewriter.h2
-rw-r--r--src/resources/itemdb.cpp16
-rw-r--r--src/resources/iteminfo.cpp10
-rw-r--r--src/resources/monsterdb.cpp16
-rw-r--r--src/resources/monsterdb.h6
-rw-r--r--src/resources/monsterinfo.cpp6
-rw-r--r--src/resources/monsterinfo.h40
-rw-r--r--src/resources/music.cpp6
-rw-r--r--src/resources/music.h6
-rw-r--r--src/resources/npcdb.cpp15
-rw-r--r--src/resources/npcdb.h6
-rw-r--r--src/resources/resource.cpp6
-rw-r--r--src/resources/resource.h6
-rw-r--r--src/resources/resourcemanager.cpp3
-rw-r--r--src/resources/soundeffect.cpp3
-rw-r--r--src/resources/soundeffect.h3
-rw-r--r--src/resources/spritedef.cpp25
-rw-r--r--src/resources/spritedef.h23
-rw-r--r--src/sprite.h12
-rw-r--r--src/utils/xml.cpp9
-rw-r--r--src/utils/xml.h9
85 files changed, 503 insertions, 980 deletions
diff --git a/src/animatedsprite.h b/src/animatedsprite.h
index 405bf42e..ddc663f2 100644
--- a/src/animatedsprite.h
+++ b/src/animatedsprite.h
@@ -60,50 +60,42 @@ class AnimatedSprite
/**
* Resets the animated sprite.
*/
- void
- reset();
+ void reset();
/**
* Plays an action using the current direction
*/
- void
- play(SpriteAction action);
+ void play(SpriteAction action);
/**
* Inform the animation of the passed time so that it can output the
* correct animation frame.
*/
- void
- update(int time);
+ void update(int time);
/**
* Draw the current animation frame at the coordinates given in screen
* pixels.
*/
- bool
- draw(Graphics* graphics, int posX, int posY) const;
+ bool draw(Graphics* graphics, int posX, int posY) const;
/**
* gets the width in pixels of the image of the current frame
*/
- int
- getWidth() const;
+ int getWidth() const;
/**
* gets the height in pixels of the image of the current frame
*/
- int
- getHeight() const;
+ int getHeight() const;
/**
* Sets the direction.
*/
- void
- setDirection(SpriteDirection direction);
+ void setDirection(SpriteDirection direction);
private:
- bool
- updateCurrentAnimation(unsigned int dt);
+ bool updateCurrentAnimation(unsigned int dt);
SpriteDirection mDirection; /**< The sprite direction. */
int mLastTime; /**< The last time update was called. */
diff --git a/src/being.cpp b/src/being.cpp
index 5eb62b2d..69da1182 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -48,9 +48,6 @@
#include "utils/tostring.h"
#include "utils/xml.h"
-#define BEING_EFFECTS_FILE "effects.xml"
-#define HAIR_FILE "hair.xml"
-
int Being::instances = 0;
int Being::mNumberOfHairstyles = 1;
ImageSet *Being::emotionSet = NULL;
diff --git a/src/configuration.cpp b/src/configuration.cpp
index a2ce4500..4fb6a42b 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -87,7 +87,6 @@ void ConfigurationObject::clear(void)
mOptions.clear();
}
-
ConfigurationObject::~ConfigurationObject(void)
{
clear();
@@ -190,7 +189,6 @@ void ConfigurationObject::writeToXML(xmlTextWriterPtr writer)
}
}
-
void Configuration::write()
{
// Do not attempt to write to file that cannot be opened for writing
diff --git a/src/equipment.cpp b/src/equipment.cpp
index f1d1d4f2..828de46b 100644
--- a/src/equipment.cpp
+++ b/src/equipment.cpp
@@ -32,8 +32,7 @@ Equipment::Equipment():
std::fill_n(mEquipment, EQUIPMENT_SIZE, 0);
}
-void
-Equipment::setEquipment(int index, int inventoryIndex)
+void Equipment::setEquipment(int index, int inventoryIndex)
{
mEquipment[index] = inventoryIndex;
Item* item = player_node->getInventory()->getItem(inventoryIndex);
diff --git a/src/floor_item.h b/src/floor_item.h
index b747310b..4a4e8fb3 100644
--- a/src/floor_item.h
+++ b/src/floor_item.h
@@ -51,42 +51,36 @@ class FloorItem : public Sprite
/**
* Returns instance id of this item.
*/
- unsigned int
- getId() const { return mId; }
+ unsigned int getId() const { return mId; }
/**
* Returns the item id.
*/
- unsigned int
- getItemId() const { return mItem->getId(); }
+ unsigned int getItemId() const { return mItem->getId(); }
/**
* Returns the x coordinate.
*/
- unsigned short
- getX() const { return mX; }
+ unsigned short getX() const { return mX; }
/**
* Returns the y coordinate.
*/
- unsigned short
- getY() const { return mY; }
+ unsigned short getY() const { return mY; }
/**
* Returns the pixel y coordinate.
*
* @see Sprite::getPixelY()
*/
- int
- getPixelY() const { return mY * 32; }
+ int getPixelY() const { return mY * 32; }
/**
* Draws this floor item to the given graphics context.
*
* @see Sprite::draw(Graphics, int, int)
*/
- void
- draw(Graphics *graphics, int offsetX, int offsetY) const
+ void draw(Graphics *graphics, int offsetX, int offsetY) const
{
graphics->drawImage(mItem->getImage(),
mX * 32 + offsetX,
diff --git a/src/graphics.cpp b/src/graphics.cpp
index 784e6e77..55ccc3b4 100644
--- a/src/graphics.cpp
+++ b/src/graphics.cpp
@@ -178,13 +178,12 @@ void Graphics::drawImagePattern(Image *image, int x, int y, int w, int h)
}
}
-void
-Graphics::drawImageRect(int x, int y, int w, int h,
- Image *topLeft, Image *topRight,
- Image *bottomLeft, Image *bottomRight,
- Image *top, Image *right,
- Image *bottom, Image *left,
- Image *center)
+void Graphics::drawImageRect(int x, int y, int w, int h,
+ Image *topLeft, Image *topRight,
+ Image *bottomLeft, Image *bottomRight,
+ Image *top, Image *right,
+ Image *bottom, Image *left,
+ Image *center)
{
pushClipArea(gcn::Rectangle(x, y, w, h));
@@ -222,9 +221,8 @@ Graphics::drawImageRect(int x, int y, int w, int h,
popClipArea();
}
-void
-Graphics::drawImageRect(int x, int y, int w, int h,
- const ImageRect &imgRect)
+void Graphics::drawImageRect(int x, int y, int w, int h,
+ const ImageRect &imgRect)
{
drawImageRect(x, y, w, h,
imgRect.grid[0], imgRect.grid[2], imgRect.grid[6], imgRect.grid[8],
diff --git a/src/graphics.h b/src/graphics.h
index efdd1ac1..bc9a95bd 100644
--- a/src/graphics.h
+++ b/src/graphics.h
@@ -95,17 +95,15 @@ class Graphics : public gcn::SDLGraphics {
* @return <code>true</code> if the image was blitted properly
* <code>false</code> otherwise.
*/
- virtual bool
- drawImage(Image *image,
- int srcX, int srcY,
- int dstX, int dstY,
- int width, int height,
- bool useColor = false);
-
- virtual void
- drawImagePattern(Image *image,
- int x, int y,
- int w, int h);
+ virtual bool drawImage(Image *image,
+ int srcX, int srcY,
+ int dstX, int dstY,
+ int width, int height,
+ bool useColor = false);
+
+ virtual void drawImagePattern(Image *image,
+ int x, int y,
+ int w, int h);
/**
* Draws a rectangle using images. 4 corner images, 4 side images and 1
diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp
index 8be32ebb..7621b856 100644
--- a/src/gui/browserbox.cpp
+++ b/src/gui/browserbox.cpp
@@ -210,8 +210,7 @@ struct MouseOverLink
int mX, mY;
};
-void
-BrowserBox::mousePressed(gcn::MouseEvent &event)
+void BrowserBox::mousePressed(gcn::MouseEvent &event)
{
LinkIterator i = find_if(mLinks.begin(), mLinks.end(),
MouseOverLink(event.getX(), event.getY()));
@@ -221,8 +220,7 @@ BrowserBox::mousePressed(gcn::MouseEvent &event)
}
}
-void
-BrowserBox::mouseMoved(gcn::MouseEvent &event)
+void BrowserBox::mouseMoved(gcn::MouseEvent &event)
{
LinkIterator i = find_if(mLinks.begin(), mLinks.end(),
MouseOverLink(event.getX(), event.getY()));
@@ -230,8 +228,7 @@ BrowserBox::mouseMoved(gcn::MouseEvent &event)
mSelectedLink = (i != mLinks.end()) ? (i - mLinks.begin()) : -1;
}
-void
-BrowserBox::draw(gcn::Graphics *graphics)
+void BrowserBox::draw(gcn::Graphics *graphics)
{
if (mOpaque)
{
diff --git a/src/gui/button.cpp b/src/gui/button.cpp
index 40ecd1b7..9653242c 100644
--- a/src/gui/button.cpp
+++ b/src/gui/button.cpp
@@ -122,8 +122,7 @@ Button::~Button()
}
}
-void
-Button::draw(gcn::Graphics *graphics)
+void Button::draw(gcn::Graphics *graphics)
{
int mode;
diff --git a/src/gui/buttonbox.cpp b/src/gui/buttonbox.cpp
index 903d971d..d29f3c58 100644
--- a/src/gui/buttonbox.cpp
+++ b/src/gui/buttonbox.cpp
@@ -34,8 +34,7 @@ ButtonBox::ButtonBox(const std::string &title, const std::string &buttonTxt,
add(button);
}
-void
-ButtonBox::action(const gcn::ActionEvent &event)
+void ButtonBox::action(const gcn::ActionEvent &event)
{
if (event.getId() == "activate")
{
diff --git a/src/gui/buttonbox.h b/src/gui/buttonbox.h
index edde4aa4..1741f7ba 100644
--- a/src/gui/buttonbox.h
+++ b/src/gui/buttonbox.h
@@ -60,8 +60,7 @@ class ButtonBox : public Window, public gcn::ActionListener
*
* @param event is the event that is generated
*/
- void
- action(const gcn::ActionEvent &event);
+ void action(const gcn::ActionEvent &event);
private:
diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp
index 08fcd2b2..750c6d6f 100644
--- a/src/gui/char_select.cpp
+++ b/src/gui/char_select.cpp
@@ -308,8 +308,7 @@ CharCreateDialog::~CharCreateDialog()
charServerHandler.setCharCreateDialog(0);
}
-void
-CharCreateDialog::action(const gcn::ActionEvent &event)
+void CharCreateDialog::action(const gcn::ActionEvent &event)
{
int numberOfColors = ColorDB::size();
if (event.getId() == "create") {
@@ -340,22 +339,19 @@ CharCreateDialog::action(const gcn::ActionEvent &event)
}
}
-std::string
-CharCreateDialog::getName()
+std::string CharCreateDialog::getName()
{
std::string name = mNameField->getText();
trim(name);
return name;
}
-void
-CharCreateDialog::unlock()
+void CharCreateDialog::unlock()
{
mCreateButton->setEnabled(true);
}
-void
-CharCreateDialog::attemptCharCreate()
+void CharCreateDialog::attemptCharCreate()
{
// Send character infos
MessageOut outMsg(mNetwork);
diff --git a/src/gui/char_server.cpp b/src/gui/char_server.cpp
index ff401332..d5452532 100644
--- a/src/gui/char_server.cpp
+++ b/src/gui/char_server.cpp
@@ -98,8 +98,7 @@ ServerSelectDialog::~ServerSelectDialog()
delete mServerListModel;
}
-void
-ServerSelectDialog::action(const gcn::ActionEvent &event)
+void ServerSelectDialog::action(const gcn::ActionEvent &event)
{
if (event.getId() == "ok") {
mOkButton->setEnabled(false);
@@ -114,14 +113,12 @@ ServerSelectDialog::action(const gcn::ActionEvent &event)
}
}
-int
-ServerListModel::getNumberOfElements()
+int ServerListModel::getNumberOfElements()
{
return n_server;
}
-std::string
-ServerListModel::getElementAt(int i)
+std::string ServerListModel::getElementAt(int i)
{
const SERVER_INFO *si = server_info[i];
return si->name + " (" + toString(si->online_users) + ")";
diff --git a/src/gui/chat.h b/src/gui/chat.h
index 437dc115..9e137499 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -107,149 +107,142 @@ struct CHATSKILL
* \ingroup Interface
*/
class ChatWindow : public Window, public gcn::ActionListener,
- public gcn::KeyListener
+ public gcn::KeyListener
{
public:
- /**
- * Constructor.
- */
- ChatWindow(Network *network);
-
- /**
- * Destructor: used to write back values to the config file
- */
- ~ChatWindow();
-
- /**
- * Logic (updates components' size)
- */
- void logic();
-
- /**
- * Adds a line of text to our message list. Parameters:
- *
- * @param line Text message.
- * @parem own Type of message (usually the owner-type).
- */
- void chatLog(std::string line, int own, bool ignoreRecord = false);
-
- /**
- * Calls original chat_log() after processing the packet.
- */
- void chatLog(CHATSKILL);
-
- /**
- * Performs action.
- */
- void action(const gcn::ActionEvent &event);
-
- /**
- * Request focus for typing chat message.
- */
- void requestChatFocus();
-
- /**
- * Checks whether ChatWindow is Focused or not.
- */
- bool isInputFocused();
-
- /**
- * Determines whether to send a command or an ordinary message, then
- * contructs packets & sends them.
- *
- * @param nick The character's name to display in front.
- * @param msg The message text which is to be send.
- *
- * NOTE:
- * The nickname is required by the server, if not specified
- * the message may not be sent unless a command was intended
- * which requires another packet to be constructed! you can
- * achieve this by putting a slash ("/") infront of the
- * message followed by the command name and the message.
- * of course all slash-commands need implemented handler-
- * routines. ;-)
- * remember, a line starting with "@" is not a command that needs
- * to be parsed rather is sent using the normal chat-packet.
- *
- * EXAMPLE:
- * // for an global announcement /- command
- * chatlog.chat_send("", "/announce Hello to all logged in users!");
- * // for simple message by a user /- message
- * chatlog.chat_send("Zaeiru", "Hello to all users on the screen!");
- */
- void
- chatSend(const std::string &nick, std::string msg);
-
- /** Called when key is pressed */
- void
- keyPressed(gcn::KeyEvent &event);
-
- /** Called to set current text */
- void
- setInputText(std::string input_str);
-
- /** Override to reset mTmpVisible */
- void
- setVisible(bool visible);
+ /**
+ * Constructor.
+ */
+ ChatWindow(Network *network);
+
+ /**
+ * Destructor: used to write back values to the config file
+ */
+ ~ChatWindow();
+
+ /**
+ * Logic (updates components' size)
+ */
+ void logic();
+
+ /**
+ * Adds a line of text to our message list. Parameters:
+ *
+ * @param line Text message.
+ * @parem own Type of message (usually the owner-type).
+ */
+ void chatLog(std::string line, int own, bool ignoreRecord = false);
+
+ /**
+ * Calls original chat_log() after processing the packet.
+ */
+ void chatLog(CHATSKILL);
+
+ /**
+ * Performs action.
+ */
+ void action(const gcn::ActionEvent &event);
+
+ /**
+ * Request focus for typing chat message.
+ */
+ void requestChatFocus();
+
+ /**
+ * Checks whether ChatWindow is Focused or not.
+ */
+ bool isInputFocused();
+
+ /**
+ * Determines whether to send a command or an ordinary message, then
+ * contructs packets & sends them.
+ *
+ * @param nick The character's name to display in front.
+ * @param msg The message text which is to be send.
+ *
+ * NOTE:
+ * The nickname is required by the server, if not specified
+ * the message may not be sent unless a command was intended
+ * which requires another packet to be constructed! you can
+ * achieve this by putting a slash ("/") infront of the
+ * message followed by the command name and the message.
+ * of course all slash-commands need implemented handler-
+ * routines. ;-)
+ * remember, a line starting with "@" is not a command that needs
+ * to be parsed rather is sent using the normal chat-packet.
+ *
+ * EXAMPLE:
+ * // for an global announcement /- command
+ * chatlog.chat_send("", "/announce Hello to all logged in users!");
+ * // for simple message by a user /- message
+ * chatlog.chat_send("Zaeiru", "Hello to all users on the screen!");
+ */
+ void chatSend(const std::string &nick, std::string msg);
+
+ /** Called when key is pressed */
+ void keyPressed(gcn::KeyEvent &event);
+
+ /** Called to set current text */
+ void setInputText(std::string input_str);
+
+ /** Override to reset mTmpVisible */
+ void setVisible(bool visible);
/**
- * Scrolls the chat window
- *
- * @param amount direction and amount to scroll. Negative numbers scroll
- * up, positive numbers scroll down. The absolute amount indicates the
- * amount of 1/8ths of chat window real estate that should be scrolled.
- */
- void
- scroll(int amount);
-
- /**
- * party implements the partying chat commands
- *
- * @param command is the party command to perform
- * @param msg is the remainder of the message
- */
- void
- party(const std::string &command, const std::string &msg);
-
- /**
- * help implements the /help command
- *
- * @param msg1 is the command that the player needs help on
- * @param msg2 is the sub-command relating to the command
- */
- void
- help(const std::string &msg1, const std::string &msg2);
+ * Scrolls the chat window
+ *
+ * @param amount direction and amount to scroll. Negative numbers scroll
+ * up, positive numbers scroll down. The absolute amount indicates the
+ * amount of 1/8ths of chat window real estate that should be scrolled.
+ */
+ void scroll(int amount);
+
+ /**
+ * party implements the partying chat commands
+ *
+ * @param command is the party command to perform
+ * @param msg is the remainder of the message
+ */
+ void party(const std::string &command, const std::string &msg);
+
+ /**
+ * help implements the /help command
+ *
+ * @param msg1 is the command that the player needs help on
+ * @param msg2 is the sub-command relating to the command
+ */
+ void help(const std::string &msg1, const std::string &msg2);
private:
- Network *mNetwork;
- bool mTmpVisible;
-
- /** One item in the chat log */
- struct CHATLOG
- {
- std::string nick;
- std::string text;
- int own;
- };
-
- /** Constructs failed messages for actions */
- std::string const_msg(CHATSKILL);
-
- gcn::TextField *mChatInput; /**< Input box for typing chat messages */
- BrowserBox *mTextOutput; /**< Text box for displaying chat history */
- ScrollArea *mScrollArea; /**< Scroll area around text output */
-
- typedef std::list<std::string> History;
- typedef History::iterator HistoryIterator;
- History mHistory; /**< Command history */
- HistoryIterator mCurHist; /**< History iterator */
- Recorder *mRecorder; /**< Recording class */
- char mPartyPrefix; /**< Messages beginning with the prefix are sent to
- the party */
- bool mReturnToggles; /**< Marks whether <Return> toggles the chat log
- or not */
- Party *mParty;
+ Network *mNetwork;
+ bool mTmpVisible;
+
+ /** One item in the chat log */
+ struct CHATLOG
+ {
+ std::string nick;
+ std::string text;
+ int own;
+ };
+
+ /** Constructs failed messages for actions */
+ std::string const_msg(CHATSKILL);
+
+ gcn::TextField *mChatInput; /**< Input box for typing chat messages */
+ BrowserBox *mTextOutput; /**< Text box for displaying chat history */
+ ScrollArea *mScrollArea; /**< Scroll area around text output */
+
+ typedef std::list<std::string> History;
+ typedef History::iterator HistoryIterator;
+ History mHistory; /**< Command history */
+ HistoryIterator mCurHist; /**< History iterator */
+ Recorder *mRecorder; /**< Recording class */
+ char mPartyPrefix; /**< Messages beginning with the prefix are sent to
+ the party */
+ bool mReturnToggles; /**< Marks whether <Return> toggles the chat log
+ or not */
+ Party *mParty;
};
extern ChatWindow *chatWindow;
diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp
index 7fc63096..63f4762a 100644
--- a/src/gui/debugwindow.cpp
+++ b/src/gui/debugwindow.cpp
@@ -67,8 +67,7 @@ DebugWindow::DebugWindow():
add(mParticleCountLabel);
}
-void
-DebugWindow::logic()
+void DebugWindow::logic()
{
// Get the current mouse position
int mouseX, mouseY;
diff --git a/src/gui/emotecontainer.h b/src/gui/emotecontainer.h
index f5922a9c..2a115f0b 100644
--- a/src/gui/emotecontainer.h
+++ b/src/gui/emotecontainer.h
@@ -33,15 +33,13 @@
#include "../resources/imageset.h"
class Image;
-class Inventory;
-class Emote;
namespace gcn {
class SelectionListener;
}
/**
- * An item container. Used to show items in inventory and trade dialog.
+ * An emote container. Used to show emotes in inventory and trade dialog.
*
* \ingroup GUI
*/
@@ -61,7 +59,7 @@ class EmoteContainer : public gcn::Widget,
virtual ~EmoteContainer();
/**
- * Draws the items.
+ * Draws the emotes.
*/
void draw(gcn::Graphics *graphics);
@@ -76,12 +74,12 @@ class EmoteContainer : public gcn::Widget,
void mousePressed(gcn::MouseEvent &event);
/**
- * Returns the selected item.
+ * Returns the selected emote.
*/
int getSelectedEmote();
/**
- * Sets selected item to NULL.
+ * Sets selected emote to NULL.
*/
void selectNone();
@@ -106,12 +104,12 @@ class EmoteContainer : public gcn::Widget,
private:
/**
- * Sets the currently selected item. Invalid (e.g., negative) indices set `no item'.
+ * Sets the currently selected emote. Invalid (e.g., negative) indices set `no emotr'.
*/
void setSelectedEmoteIndex(int index);
/**
- * Find the current item index by the most recently used item ID
+ * Find the current emote index by the most recently used emote ID
*/
void refindSelectedEmote(void);
diff --git a/src/gui/emotewindow.h b/src/gui/emotewindow.h
index a382e37d..dbe4efd7 100644
--- a/src/gui/emotewindow.h
+++ b/src/gui/emotewindow.h
@@ -67,7 +67,6 @@ class EmoteWindow : public Window, gcn::ActionListener,
void widgetResized(const gcn::Event &event);
private:
-
EmoteContainer *mEmotes;
gcn::Button *mUseButton;
diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp
index df8cf24e..4cb885c3 100644
--- a/src/gui/inttextbox.cpp
+++ b/src/gui/inttextbox.cpp
@@ -29,8 +29,7 @@ IntTextBox::IntTextBox(int i):
{
}
-void
-IntTextBox::keyPressed(gcn::KeyEvent &event)
+void IntTextBox::keyPressed(gcn::KeyEvent &event)
{
const gcn::Key &key = event.getKey();
diff --git a/src/gui/inttextbox.h b/src/gui/inttextbox.h
index 9c6e8bf4..d134fcd7 100644
--- a/src/gui/inttextbox.h
+++ b/src/gui/inttextbox.h
@@ -55,8 +55,7 @@ class IntTextBox : public TextField
/**
* Responds to key presses.
*/
- void
- keyPressed(gcn::KeyEvent &event);
+ void keyPressed(gcn::KeyEvent &event);
private:
int mMin; /**< Minimum value */
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
deleted file mode 100644
index 055cbe44..00000000
--- a/src/gui/itempopup.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * The Legend of Mazzeroth
- * Copyright (C) 2008, The Legend of Mazzeroth Development Team
- *
- * This file is part of The Legend of Mazzeroth based on original code
- * from The Mana World.
- *
- * The Legend of Mazzeroth 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 Legend of Mazzeroth 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 Legend of Mazzeroth; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <guichan/widgets/label.hpp>
-
-#include "gui.h"
-#include "itempopup.h"
-
-#include "widgets/layout.h"
-
-#include "../resources/image.h"
-#include "../resources/iteminfo.h"
-#include "../resources/resourcemanager.h"
-#include "../utils/gettext.h"
-#include "../utils/strprintf.h"
-
-ItemPopup::ItemPopup()
-{
-
- setResizable(false);
- setTitleBarHeight(0);
-
- // Item Name
- mItemName = new gcn::Label("Label");
- mItemName->setFont(gui->getFont());
- mItemName->setPosition(2, 2);
- mItemName->setWidth(getWidth() - 4);
-
- // Item Description
- mItemDesc = new TextBox();
- mItemDesc->setEditable(false);
- mItemDescScroll = new ScrollArea(mItemDesc);
-
- mItemDescScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemDescScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemDescScroll->setDimension(gcn::Rectangle(0, 0, 196, 14));
- mItemDescScroll->setOpaque(false);
- mItemDescScroll->setPosition(2, 15);
-
- // Item Effect
- mItemEffect = new TextBox();
- mItemEffect->setEditable(false);
- mItemEffectScroll = new ScrollArea(mItemEffect);
-
- mItemEffectScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemEffectScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_NEVER);
- mItemEffectScroll->setDimension(gcn::Rectangle(0, 0, 196, 14));
- mItemEffectScroll->setOpaque(false);
- mItemEffectScroll->setPosition(2, 35);
-
- add(mItemName);
- add(mItemDescScroll);
- add(mItemEffectScroll);
-
- setLocationRelativeTo(getParent());
-
- // LEEOR / TODO: This causes an exception error.
- //moveToBottom(getParent());
-
- mItemDesc->setTextWrapped( "" );
- mItemEffect->setTextWrapped( "" );
-}
-
-void ItemPopup::setItem(Item *item)
-{
-
- ItemInfo const *info = item ? &item->getInfo() : NULL;
-
- mItemName->setCaption(info->getName());
- mItemDesc->setTextWrapped( info->getDescription() );
- mItemEffect->setTextWrapped( info->getEffect() );
-
- int numRowsDesc = mItemDesc->getNumberOfRows();
- int numRowsEffect = mItemEffect->getNumberOfRows();
-
- if(info->getEffect() == "")
- {
- setContentSize(200, (numRowsDesc * 14) + 30);
- } else {
- setContentSize(200, (numRowsDesc * 14) + (numRowsEffect*14) + 30);
- }
-
- mItemDescScroll->setDimension(gcn::Rectangle(2, 0, 196, numRowsDesc * 14));
-
- mItemEffectScroll->setDimension(gcn::Rectangle(2, 0, 196, numRowsEffect * 14));
-
- mItemDescScroll->setPosition(2, 20);
- mItemEffectScroll->setPosition(2, (numRowsDesc * 15) + 25);
-}
-
-unsigned int ItemPopup::getNumRows()
-{
- return mItemDesc->getNumberOfRows(), mItemEffect->getNumberOfRows();
-}
diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h
deleted file mode 100644
index 0082ec2c..00000000
--- a/src/gui/itempopup.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-*
- * The Legend of Mazzeroth
- * Copyright (C) 2008, The Legend of Mazzeroth Development Team
- *
- * This file is part of The Legend of Mazzeroth based on original code
- * from The Mana World.
- *
- * The Legend of Mazzeroth 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 Legend of Mazzeroth 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 Legend of Mazzeroth; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef _LOM_ITEMPOPUP_H__
-#define _LOM_ITEMPOPUP_H__
-
-#include "scrollarea.h"
-#include "textbox.h"
-#include "window.h"
-
-#include "../item.h"
-
-class ItemPopup : public Window
- {
- public:
-
- ItemPopup();
-
- void setItem(Item *item);
- unsigned int getNumRows();
-
- private:
- gcn::Label *mItemName;
- TextBox *mItemDesc;
- TextBox *mItemEffect;
- ScrollArea *mItemDescScroll;
- ScrollArea *mItemEffectScroll;
-
- };
-
-#endif
diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp
index 4dca66a0..7e28e1f5 100644
--- a/src/gui/listbox.cpp
+++ b/src/gui/listbox.cpp
@@ -57,8 +57,7 @@ void ListBox::draw(gcn::Graphics *graphics)
}
}
-void
-ListBox::mouseDragged(gcn::MouseEvent &event)
+void ListBox::mouseDragged(gcn::MouseEvent &event)
{
// Pretend mouse is pressed continuously while dragged. Causes list
// selection to be updated as is default in many GUIs.
diff --git a/src/gui/login.cpp b/src/gui/login.cpp
index 18976b46..bba69754 100644
--- a/src/gui/login.cpp
+++ b/src/gui/login.cpp
@@ -188,8 +188,7 @@ bool LoginDialog::canSubmit()
state == LOGIN_STATE;
}
-bool
-LoginDialog::isUShort(const std::string &str)
+bool LoginDialog::isUShort(const std::string &str)
{
if (str == "")
{
@@ -212,8 +211,7 @@ LoginDialog::isUShort(const std::string &str)
return true;
}
-unsigned short
-LoginDialog::getUShort(const std::string &str)
+unsigned short LoginDialog::getUShort(const std::string &str)
{
unsigned long l = 0;
for (std::string::const_iterator strPtr = str.begin(), strEnd = str.end();
@@ -228,9 +226,8 @@ LoginDialog::getUShort(const std::string &str)
* LoginDialog::DropDownList
*/
-void
-LoginDialog::DropDownList::saveEntry(const std::string &server,
- const std::string &port, int &saved)
+void LoginDialog::DropDownList::saveEntry(const std::string &server,
+ const std::string &port, int &saved)
{
if (saved < MAX_SERVER_LIST_SIZE && server != "")
{
@@ -272,9 +269,8 @@ LoginDialog::DropDownList::DropDownList(std::string prefix,
}
}
-void
-LoginDialog::DropDownList::save(const std::string &server,
- const std::string &port)
+void LoginDialog::DropDownList::save(const std::string &server,
+ const std::string &port)
{
int position = 0;
saveEntry(server, port, position);
@@ -292,14 +288,12 @@ LoginDialog::DropDownList::save(const std::string &server,
}
}
-int
-LoginDialog::DropDownList::getNumberOfElements()
+int LoginDialog::DropDownList::getNumberOfElements()
{
return mServers.size();
}
-std::string
-LoginDialog::DropDownList::getElementAt(int i)
+std::string LoginDialog::DropDownList::getElementAt(int i)
{
if (i < 0 || i >= getNumberOfElements())
{
@@ -308,8 +302,7 @@ LoginDialog::DropDownList::getElementAt(int i)
return getServerAt(i) + ":" + getPortAt(i);
}
-std::string
-LoginDialog::DropDownList::getServerAt(int i)
+std::string LoginDialog::DropDownList::getServerAt(int i)
{
if (i < 0 || i >= getNumberOfElements())
{
@@ -318,9 +311,7 @@ LoginDialog::DropDownList::getServerAt(int i)
return mServers.at(i);
}
-
-std::string
-LoginDialog::DropDownList::getPortAt(int i)
+std::string LoginDialog::DropDownList::getPortAt(int i)
{
if (i < 0 || i >= getNumberOfElements())
{
diff --git a/src/gui/login.h b/src/gui/login.h
index 3b911424..d1d75ebc 100644
--- a/src/gui/login.h
+++ b/src/gui/login.h
@@ -74,8 +74,7 @@ class LoginDialog : public Window, public gcn::ActionListener,
* Returns whether submit can be enabled. This is true in the login
* state, when all necessary fields have some text.
*/
- bool
- canSubmit();
+ bool canSubmit();
/**
* Function to decide whether string is an unsigned short or not
@@ -84,8 +83,7 @@ class LoginDialog : public Window, public gcn::ActionListener,
*
* @return true is str is an unsigned short, false otherwise
*/
- static bool
- isUShort(const std::string &str);
+ static bool isUShort(const std::string &str);
/**
* Converts string to an unsigned short (undefined if invalid)
@@ -94,8 +92,7 @@ class LoginDialog : public Window, public gcn::ActionListener,
*
* @return the value str represents
*/
- static unsigned short
- getUShort(const std::string &str);
+ static unsigned short getUShort(const std::string &str);
DropDown *mServerDropDown;
gcn::TextField *mUserField;
diff --git a/src/gui/passwordfield.h b/src/gui/passwordfield.h
index 9aa6ab49..e31b1779 100644
--- a/src/gui/passwordfield.h
+++ b/src/gui/passwordfield.h
@@ -31,7 +31,8 @@
*
* \ingroup GUI
*/
-class PasswordField : public TextField {
+class PasswordField : public TextField
+{
public:
/**
* Constructor, initializes the password field with the given string.
diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp
index e5227e5a..92722417 100644
--- a/src/gui/playerbox.cpp
+++ b/src/gui/playerbox.cpp
@@ -76,8 +76,7 @@ PlayerBox::~PlayerBox()
}
}
-void
-PlayerBox::draw(gcn::Graphics *graphics)
+void PlayerBox::draw(gcn::Graphics *graphics)
{
if (mPlayer)
{
@@ -90,8 +89,7 @@ PlayerBox::draw(gcn::Graphics *graphics)
}
}
-void
-PlayerBox::drawFrame(gcn::Graphics *graphics)
+void PlayerBox::drawFrame(gcn::Graphics *graphics)
{
int w, h, bs;
bs = getFrameSize();
diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h
index 7aec87bf..3ccb5fad 100644
--- a/src/gui/playerbox.h
+++ b/src/gui/playerbox.h
@@ -53,8 +53,7 @@ class PlayerBox : public gcn::ScrollArea
* player to <code>NULL</code> causes the box not to draw any
* character.
*/
- void
- setPlayer(const Player *player) { mPlayer = player; }
+ void setPlayer(const Player *player) { mPlayer = player; }
/**
* Draws the scroll area.
diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp
index 708a2991..b4117c80 100644
--- a/src/gui/progressbar.cpp
+++ b/src/gui/progressbar.cpp
@@ -88,8 +88,7 @@ void ProgressBar::logic()
if (mBlueToGo < mBlue) mBlue--;
}
-void
-ProgressBar::draw(gcn::Graphics *graphics)
+void ProgressBar::draw(gcn::Graphics *graphics)
{
static_cast<Graphics*>(graphics)->
drawImageRect(0, 0, getWidth(), getHeight(), mBorder);
@@ -104,16 +103,14 @@ ProgressBar::draw(gcn::Graphics *graphics)
}
}
-void
-ProgressBar::setProgress(float progress)
+void ProgressBar::setProgress(float progress)
{
if (progress < 0.0f) mProgress = 0.0;
else if (progress > 1.0f) mProgress = 1.0;
else mProgress = progress;
}
-void
-ProgressBar::setColor(Uint8 red, Uint8 green, Uint8 blue)
+void ProgressBar::setColor(Uint8 red, Uint8 green, Uint8 blue)
{
mRedToGo = red;
mGreenToGo = green;
diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h
index a20c901f..d2ace66c 100644
--- a/src/gui/progressbar.h
+++ b/src/gui/progressbar.h
@@ -52,50 +52,42 @@ class ProgressBar : public gcn::Widget {
/**
* Performs progress bar logic (fading colors)
*/
- void
- logic();
+ void logic();
/**
* Draws the progress bar.
*/
- void
- draw(gcn::Graphics *graphics);
+ void draw(gcn::Graphics *graphics);
/**
* Sets the current progress.
*/
- void
- setProgress(float progress);
+ void setProgress(float progress);
/**
* Returns the current progress.
*/
- float
- getProgress() { return mProgress; }
+ float getProgress() { return mProgress; }
/**
* Change the filling of the progress bar.
*/
- void
- setColor(Uint8, Uint8 green, Uint8 blue);
+ void setColor(Uint8, Uint8 green, Uint8 blue);
/**
* Get The red value of color
*/
- Uint8
- getRed() { return mRed; }
+ Uint8 getRed() { return mRed; }
/**
* Get The red value of color
*/
- Uint8
- getGreen() { return mGreen; }
+ Uint8 getGreen() { return mGreen; }
/**
* Get The red value of color
*/
- Uint8
- getBlue() { return mBlue; }
+ Uint8 getBlue() { return mBlue; }
private:
float mProgress;
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 5d687425..568ec5ff 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -43,14 +43,12 @@
#include "../utils/gettext.h"
#include "../utils/strprintf.h"
-void
-WrongDataNoticeListener::setTarget(gcn::TextField *textField)
+void WrongDataNoticeListener::setTarget(gcn::TextField *textField)
{
mTarget = textField;
}
-void
-WrongDataNoticeListener::action(const gcn::ActionEvent &event)
+void WrongDataNoticeListener::action(const gcn::ActionEvent &event)
{
if (event.getId() == "ok")
{
@@ -173,8 +171,7 @@ RegisterDialog::~RegisterDialog()
delete mWrongDataNoticeListener;
}
-void
-RegisterDialog::action(const gcn::ActionEvent &event)
+void RegisterDialog::action(const gcn::ActionEvent &event)
{
if (event.getId() == "cancel")
{
@@ -263,14 +260,12 @@ RegisterDialog::action(const gcn::ActionEvent &event)
}
}
-void
-RegisterDialog::keyPressed(gcn::KeyEvent &keyEvent)
+void RegisterDialog::keyPressed(gcn::KeyEvent &keyEvent)
{
mRegisterButton->setEnabled(canSubmit());
}
-bool
-RegisterDialog::canSubmit()
+bool RegisterDialog::canSubmit()
{
return !mUserField->getText().empty() &&
!mPasswordField->getText().empty() &&
@@ -280,8 +275,7 @@ RegisterDialog::canSubmit()
state == REGISTER_STATE;
}
-bool
-RegisterDialog::isUShort(const std::string &str)
+bool RegisterDialog::isUShort(const std::string &str)
{
if (str == "")
{
@@ -304,8 +298,7 @@ RegisterDialog::isUShort(const std::string &str)
return true;
}
-unsigned short
-RegisterDialog::getUShort(const std::string &str)
+unsigned short RegisterDialog::getUShort(const std::string &str)
{
unsigned long l = 0;
for (std::string::const_iterator strPtr = str.begin(), strEnd = str.end();
diff --git a/src/gui/register.h b/src/gui/register.h
index 87a11bb9..4c1d9f88 100644
--- a/src/gui/register.h
+++ b/src/gui/register.h
@@ -84,8 +84,7 @@ class RegisterDialog : public Window, public gcn::ActionListener,
* Returns whether submit can be enabled. This is true in the register
* state, when all necessary fields have some text.
*/
- bool
- canSubmit();
+ bool canSubmit();
/**
* Function to decide whether string is an unsigned short or not
@@ -94,8 +93,7 @@ class RegisterDialog : public Window, public gcn::ActionListener,
*
* @return true if str is an unsigned short, false otherwise
*/
- static bool
- isUShort(const std::string &str);
+ static bool isUShort(const std::string &str);
/**
* Converts string to an unsigned short (undefined if invalid)
@@ -104,8 +102,7 @@ class RegisterDialog : public Window, public gcn::ActionListener,
*
* @return the value str represents
*/
- static unsigned short
- getUShort(const std::string &str);
+ static unsigned short getUShort(const std::string &str);
gcn::TextField *mUserField;
gcn::TextField *mPasswordField;
diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h
index dfc3da38..370a2d2e 100644
--- a/src/gui/setup_video.h
+++ b/src/gui/setup_video.h
@@ -42,8 +42,7 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
void action(const gcn::ActionEvent &event);
/** Called when key is pressed */
- void
- keyPressed(gcn::KeyEvent &event);
+ void keyPressed(gcn::KeyEvent &event);
private:
bool mFullScreenEnabled;
@@ -86,12 +85,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener,
gcn::Slider *mParticleDetailSlider;
gcn::Label *mParticleDetailField;
- void
- updateSliders(bool originalValues);
+ void updateSliders(bool originalValues);
- int
- updateSlider(gcn::Slider *slider, gcn::TextField *field,
- const std::string &configName);
+ int updateSlider(gcn::Slider *slider, gcn::TextField *field,
+ const std::string &configName);
};
#endif
diff --git a/src/gui/status.h b/src/gui/status.h
index eb4171c9..aa20d094 100644
--- a/src/gui/status.h
+++ b/src/gui/status.h
@@ -33,7 +33,6 @@
class LocalPlayer;
class ProgressBar;
-
/**
* The player status dialog.
*
diff --git a/src/gui/table.cpp b/src/gui/table.cpp
index e4d7812e..264d9864 100644
--- a/src/gui/table.cpp
+++ b/src/gui/table.cpp
@@ -63,8 +63,7 @@ GuiTableActionListener::~GuiTableActionListener(void)
}
}
-void
-GuiTableActionListener::action(const gcn::ActionEvent& actionEvent)
+void GuiTableActionListener::action(const gcn::ActionEvent& actionEvent)
{
mTable->setSelected(mRow, mColumn);
mTable->distributeActionEvent();
@@ -88,14 +87,12 @@ GuiTable::~GuiTable(void)
delete mModel;
}
-TableModel *
-GuiTable::getModel(void) const
+TableModel* GuiTable::getModel(void) const
{
return mModel;
}
-void
-GuiTable::setModel(TableModel *new_model)
+void GuiTable::setModel(TableModel *new_model)
{
if (mModel) {
uninstallActionListeners();
@@ -112,9 +109,7 @@ GuiTable::setModel(TableModel *new_model)
}
}
-
-void
-GuiTable::recomputeDimensions(void)
+void GuiTable::recomputeDimensions(void)
{
int rows_nr = mModel->getRows();
int columns_nr = mModel->getColumns();
@@ -136,33 +131,28 @@ GuiTable::recomputeDimensions(void)
setHeight(height);
}
-void
-GuiTable::setSelected(int row, int column)
+void GuiTable::setSelected(int row, int column)
{
mSelectedColumn = column;
mSelectedRow = row;
}
-int
-GuiTable::getSelectedRow(void)
+int GuiTable::getSelectedRow(void)
{
return mSelectedRow;
}
-int
-GuiTable::getSelectedColumn(void)
+int GuiTable::getSelectedColumn(void)
{
return mSelectedColumn;
}
-void
-GuiTable::setLinewiseSelection(bool linewise)
+void GuiTable::setLinewiseSelection(bool linewise)
{
mLinewiseMode = linewise;
}
-int
-GuiTable::getRowHeight(void)
+int GuiTable::getRowHeight(void)
{
if (mModel)
return mModel->getRowHeight() + 1; // border
@@ -170,8 +160,7 @@ GuiTable::getRowHeight(void)
return 0;
}
-int
-GuiTable::getColumnWidth(int i)
+int GuiTable::getColumnWidth(int i)
{
if (mModel)
return mModel->getColumnWidth(i) + 1; // border
@@ -179,16 +168,14 @@ GuiTable::getColumnWidth(int i)
return 0;
}
-void
-GuiTable::uninstallActionListeners(void)
+void GuiTable::uninstallActionListeners(void)
{
for (std::vector<GuiTableActionListener *>::const_iterator it = action_listeners.begin(); it != action_listeners.end(); it++)
delete *it;
action_listeners.clear();
}
-void
-GuiTable::installActionListeners(void)
+void GuiTable::installActionListeners(void)
{
if (!mModel)
return;
@@ -207,8 +194,7 @@ GuiTable::installActionListeners(void)
}
// -- widget ops
-void
-GuiTable::draw(gcn::Graphics* graphics)
+void GuiTable::draw(gcn::Graphics* graphics)
{
graphics->setColor(getBackgroundColor());
graphics->fillRectangle(gcn::Rectangle(0, 0, getWidth(), getHeight()));
@@ -282,42 +268,35 @@ GuiTable::draw(gcn::Graphics* graphics)
}
}
-void
-GuiTable::logic(void)
+void GuiTable::logic(void)
{
}
-void
-GuiTable::moveToTop(gcn::Widget *widget)
+void GuiTable::moveToTop(gcn::Widget *widget)
{
gcn::Widget::moveToTop(widget);
this->mTopWidget = widget;
}
-void
-GuiTable::moveToBottom(gcn::Widget *widget)
+void GuiTable::moveToBottom(gcn::Widget *widget)
{
gcn::Widget::moveToBottom(widget);
if (widget == this->mTopWidget)
this->mTopWidget = NULL;
}
-gcn::Rectangle
-GuiTable::getChildrenArea(void)
+gcn::Rectangle GuiTable::getChildrenArea(void)
{
return gcn::Rectangle(0, 0, getWidth(), getHeight());
}
// -- KeyListener notifications
-void
-GuiTable::keyPressed(gcn::KeyEvent& keyEvent)
+void GuiTable::keyPressed(gcn::KeyEvent& keyEvent)
{
}
-
// -- MouseListener notifications
-void
-GuiTable::mousePressed(gcn::MouseEvent& mouseEvent)
+void GuiTable::mousePressed(gcn::MouseEvent& mouseEvent)
{
if (mouseEvent.getButton() == gcn::MouseEvent::LEFT) {
int row = getRowForY(mouseEvent.getY());
@@ -332,24 +311,20 @@ GuiTable::mousePressed(gcn::MouseEvent& mouseEvent)
}
}
-void
-GuiTable::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent)
+void GuiTable::mouseWheelMovedUp(gcn::MouseEvent& mouseEvent)
{
}
-void
-GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent)
+void GuiTable::mouseWheelMovedDown(gcn::MouseEvent& mouseEvent)
{
}
-void
-GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent)
+void GuiTable::mouseDragged(gcn::MouseEvent& mouseEvent)
{
}
// -- TableModelListener notifications
-void
-GuiTable::modelUpdated(bool completed)
+void GuiTable::modelUpdated(bool completed)
{
if (completed) {
recomputeDimensions();
@@ -360,8 +335,7 @@ GuiTable::modelUpdated(bool completed)
}
}
-gcn::Widget *
-GuiTable::getWidgetAt(int x, int y)
+gcn::Widget* GuiTable::getWidgetAt(int x, int y)
{
int row = getRowForY(y);
int column = getColumnForX(x);
@@ -381,8 +355,7 @@ GuiTable::getWidgetAt(int x, int y)
return NULL;
}
-int
-GuiTable::getRowForY(int y)
+int GuiTable::getRowForY(int y)
{
int row = y / getRowHeight();
@@ -393,8 +366,7 @@ GuiTable::getRowForY(int y)
return row;
}
-int
-GuiTable::getColumnForX(int x)
+int GuiTable::getColumnForX(int x)
{
int column;
int delta = 0;
@@ -412,9 +384,7 @@ GuiTable::getColumnForX(int x)
return column;
}
-
-void
-GuiTable::_setFocusHandler(gcn::FocusHandler* focusHandler)
+void GuiTable::_setFocusHandler(gcn::FocusHandler* focusHandler)
{
gcn::Widget::_setFocusHandler(focusHandler);
diff --git a/src/gui/table_model.cpp b/src/gui/table_model.cpp
index e1afef96..9911eec3 100644
--- a/src/gui/table_model.cpp
+++ b/src/gui/table_model.cpp
@@ -25,27 +25,23 @@
#include "table_model.h"
-void
-TableModel::installListener(TableModelListener *listener)
+void TableModel::installListener(TableModelListener *listener)
{
listeners.insert(listener);
}
-void
-TableModel::removeListener(TableModelListener *listener)
+void TableModel::removeListener(TableModelListener *listener)
{
listeners.erase(listener);
}
-void
-TableModel::signalBeforeUpdate(void)
+void TableModel::signalBeforeUpdate(void)
{
for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++)
(*it)->modelUpdated(false);
}
-void
-TableModel::signalAfterUpdate(void)
+void TableModel::signalAfterUpdate(void)
{
for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); it != listeners.end(); it++)
(*it)->modelUpdated(true);
@@ -72,16 +68,14 @@ StaticTableModel::~StaticTableModel(void)
delete *it;
}
-void
-StaticTableModel::resize(void)
+void StaticTableModel::resize(void)
{
mRows = getRows();
mColumns = getColumns();
mTableModel.resize(mRows * mColumns, NULL);
}
-void
-StaticTableModel::set(int row, int column, gcn::Widget *widget)
+void StaticTableModel::set(int row, int column, gcn::Widget *widget)
{
if (row >= mRows || row < 0
|| column >= mColumns || column < 0)
@@ -106,14 +100,12 @@ StaticTableModel::set(int row, int column, gcn::Widget *widget)
signalAfterUpdate();
}
-gcn::Widget *
-StaticTableModel::getElementAt(int row, int column)
+gcn::Widget* StaticTableModel::getElementAt(int row, int column)
{
return mTableModel[WIDGET_AT(row, column)];
}
-void
-StaticTableModel::fixColumnWidth(int column, int width)
+void StaticTableModel::fixColumnWidth(int column, int width)
{
if (width < 0
|| column < 0 || column >= mColumns)
@@ -122,8 +114,7 @@ StaticTableModel::fixColumnWidth(int column, int width)
mWidths[column] = -width; // Negate to tag as fixed
}
-void
-StaticTableModel::fixRowHeight(int height)
+void StaticTableModel::fixRowHeight(int height)
{
if (height < 0)
return;
@@ -131,14 +122,12 @@ StaticTableModel::fixRowHeight(int height)
mHeight = -height;
}
-int
-StaticTableModel::getRowHeight(void)
+int StaticTableModel::getRowHeight(void)
{
return abs(mHeight);
}
-int
-StaticTableModel::getColumnWidth(int column)
+int StaticTableModel::getColumnWidth(int column)
{
if (column < 0 || column >= mColumns)
return 0;
@@ -146,14 +135,12 @@ StaticTableModel::getColumnWidth(int column)
return abs(mWidths[column]);
}
-int
-StaticTableModel::getRows(void)
+int StaticTableModel::getRows(void)
{
return mRows;
}
-int
-StaticTableModel::getColumns(void)
+int StaticTableModel::getColumns(void)
{
return mColumns;
}
diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp
index 7f9abd3a..248afcbf 100644
--- a/src/gui/truetypefont.cpp
+++ b/src/gui/truetypefont.cpp
@@ -17,16 +17,14 @@
* You should have received a copy of the GNU General Public License
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
*/
-#include "truetypefont.h"
-
#include <list>
#include <guichan/exception.hpp>
+#include "truetypefont.h"
+
#include "../graphics.h"
#include "../resources/image.h"
@@ -77,7 +75,6 @@ class TextChunk
gcn::Color color;
};
-
// Word surfaces cache
static std::list<TextChunk> cache;
typedef std::list<TextChunk>::iterator CacheIterator;
@@ -114,8 +111,8 @@ TrueTypeFont::~TrueTypeFont()
}
void TrueTypeFont::drawString(gcn::Graphics *graphics,
- const std::string &text,
- int x, int y)
+ const std::string &text,
+ int x, int y)
{
if (text.empty())
{
diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h
index 7a4ee9ac..67c39e6a 100644
--- a/src/gui/truetypefont.h
+++ b/src/gui/truetypefont.h
@@ -17,8 +17,6 @@
* You should have received a copy of the GNU General Public License
* along with The Mana World; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * $Id$
*/
#ifndef _TMW_TRUETYPEFONT_H
diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp
index fab048fc..9311b59b 100644
--- a/src/gui/updatewindow.cpp
+++ b/src/gui/updatewindow.cpp
@@ -69,8 +69,7 @@ static unsigned long fadler32(FILE *file)
/**
* Load the given file into a vector of strings.
*/
-std::vector<std::string>
-loadTextFile(const std::string &fileName)
+std::vector<std::string> loadTextFile(const std::string &fileName)
{
std::vector<std::string> lines;
std::ifstream fin(fileName.c_str());
@@ -242,8 +241,7 @@ int UpdaterWindow::updateProgress(void *ptr,
return 0;
}
-size_t
-UpdaterWindow::memoryWrite(void *ptr, size_t size, size_t nmemb, FILE *stream)
+size_t UpdaterWindow::memoryWrite(void *ptr, size_t size, size_t nmemb, FILE *stream)
{
UpdaterWindow *uw = reinterpret_cast<UpdaterWindow *>(stream);
size_t totalMem = size * nmemb;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 5bb29987..5fcb7dc9 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -46,8 +46,6 @@
extern volatile int tick_time;
-extern volatile int tick_time;
-
Viewport::Viewport():
mMap(0),
mPixelViewX(0.0f),
diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp
index 87527f0a..6009d5f5 100644
--- a/src/gui/widgets/resizegrip.cpp
+++ b/src/gui/widgets/resizegrip.cpp
@@ -56,8 +56,7 @@ ResizeGrip::~ResizeGrip()
}
}
-void
-ResizeGrip::draw(gcn::Graphics *graphics)
+void ResizeGrip::draw(gcn::Graphics *graphics)
{
static_cast<Graphics*>(graphics)->drawImage(gripImage, 0, 0);
}
diff --git a/src/gui/window.h b/src/gui/window.h
index 89cc75a5..d864290c 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -157,8 +157,7 @@ class Window : public gcn::Window, gcn::WidgetListener
*
* @return The parent window or <code>NULL</code> if there is none.
*/
- Window*
- getParentWindow() { return mParent; }
+ Window* getParentWindow() { return mParent; }
/**
* Schedule this window for deletion. It will be deleted at the start
@@ -198,14 +197,12 @@ class Window : public gcn::Window, gcn::WidgetListener
/**
* Sets the name of the window. This is not the window title.
*/
- void
- setWindowName(const std::string &name) { mWindowName = name; }
+ void setWindowName(const std::string &name) { mWindowName = name; }
/**
* Returns the name of the window. This is not the window title.
*/
- const std::string&
- getWindowName() { return mWindowName; }
+ const std::string& getWindowName() { return mWindowName; }
/**
* Reads the position (and the size for resizable windows) in the
diff --git a/src/item.h b/src/item.h
index eb6fed77..bb6fcbdc 100644
--- a/src/item.h
+++ b/src/item.h
@@ -46,14 +46,12 @@ class Item
/**
* Sets the item id, identifying the item type.
*/
- void
- setId(int id);
+ void setId(int id);
/**
* Returns the item id.
*/
- int
- getId() const { return mId; }
+ int getId() const { return mId; }
/**
* Returns the item image.
@@ -63,62 +61,52 @@ class Item
/**
* Sets the number of items.
*/
- void
- setQuantity(int quantity) { mQuantity = quantity; }
+ void setQuantity(int quantity) { mQuantity = quantity; }
/**
* Increases the number of items by the given amount.
*/
- void
- increaseQuantity(int amount) { mQuantity += amount; }
+ void increaseQuantity(int amount) { mQuantity += amount; }
/**
* Returns the number of items.
*/
- int
- getQuantity() const { return mQuantity; }
+ int getQuantity() const { return mQuantity; }
/**
* Sets whether this item is considered equipment.
*/
- void
- setEquipment(bool equipment) { mEquipment = equipment; }
+ void setEquipment(bool equipment) { mEquipment = equipment; }
/**
* Returns whether this item is considered equipment.
*/
- bool
- isEquipment() const { return mEquipment; }
+ bool isEquipment() const { return mEquipment; }
/**
* Sets whether this item is equipped.
*/
- void
- setEquipped(bool equipped) { mEquipped = equipped; }
+ void setEquipped(bool equipped) { mEquipped = equipped; }
/**
* Returns whether this item is equipped.
*/
- bool
- isEquipped() const { return mEquipped; }
+ bool isEquipped() const { return mEquipped; }
/**
* Sets the inventory index of this item.
*/
- void
- setInvIndex(int index) { mInvIndex = index; }
+ void setInvIndex(int index) { mInvIndex = index; }
/**
* Returns the inventory index of this item.
*/
- int
- getInvIndex() const { return mInvIndex; }
+ int getInvIndex() const { return mInvIndex; }
/**
* Returns information about this item type.
*/
- const ItemInfo&
- getInfo() const { return ItemDB::get(mId); }
+ const ItemInfo& getInfo() const { return ItemDB::get(mId); }
protected:
int mId; /**< Item type id. */
diff --git a/src/map.h b/src/map.h
index 81d0b629..b299fdb5 100644
--- a/src/map.h
+++ b/src/map.h
@@ -182,8 +182,7 @@ class Map : public Properties
/**
* Finds the tile set that a tile with the given global id is part of.
*/
- Tileset*
- getTilesetWithGid(int gid) const;
+ Tileset* getTilesetWithGid(int gid) const;
/**
* Get tile reference.
@@ -203,26 +202,22 @@ class Map : public Properties
/**
* Returns the width of this map.
*/
- int
- getWidth() const { return mWidth; }
+ int getWidth() const { return mWidth; }
/**
* Returns the height of this map.
*/
- int
- getHeight() const { return mHeight; }
+ int getHeight() const { return mHeight; }
/**
* Returns the tile width of this map.
*/
- int
- getTileWidth() const { return mTileWidth; }
+ int getTileWidth() const { return mTileWidth; }
/**
* Returns the tile height used by this map.
*/
- int
- getTileHeight() const { return mTileHeight; }
+ int getTileHeight() const { return mTileHeight; }
/**
* Find a path from one location to the next.
@@ -232,14 +227,12 @@ class Map : public Properties
/**
* Adds a sprite to the map.
*/
- SpriteIterator
- addSprite(Sprite *sprite);
+ SpriteIterator addSprite(Sprite *sprite);
/**
* Removes a sprite from the map.
*/
- void
- removeSprite(SpriteIterator iterator);
+ void removeSprite(SpriteIterator iterator);
/**
* Adds a particle effect
@@ -266,9 +259,8 @@ class Map : public Properties
/**
* Draws the overlay graphic to the given graphics output.
*/
- void
- drawOverlay(Graphics *graphics, float scrollX, float scrollY,
- int detail);
+ void drawOverlay(Graphics *graphics, float scrollX, float scrollY,
+ int detail);
/**
* Tells whether a tile is occupied by a being.
diff --git a/src/monster.h b/src/monster.h
index cb8f7f18..7a8cd2a7 100644
--- a/src/monster.h
+++ b/src/monster.h
@@ -62,8 +62,7 @@ class Monster : public Being
/**
* Returns the MonsterInfo, with static data about this monster.
*/
- const MonsterInfo&
- getInfo() const;
+ const MonsterInfo& getInfo() const;
/**
* Determine whether the mob should show it's name
diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp
index 345e02fc..387af70c 100644
--- a/src/net/messagein.cpp
+++ b/src/net/messagein.cpp
@@ -38,15 +38,13 @@ MessageIn::MessageIn(const char *data, unsigned int length):
mId = readInt16();
}
-Sint8
-MessageIn::readInt8()
+Sint8 MessageIn::readInt8()
{
assert(mPos < mLength);
return mData[mPos++];
}
-Sint16
-MessageIn::readInt16()
+Sint16 MessageIn::readInt16()
{
assert(mPos + 2 <= mLength);
mPos += 2;
@@ -57,8 +55,7 @@ MessageIn::readInt16()
#endif
}
-Sint32
-MessageIn::readInt32()
+Sint32 MessageIn::readInt32()
{
assert(mPos + 4 <= mLength);
mPos += 4;
@@ -69,8 +66,7 @@ MessageIn::readInt32()
#endif
}
-void
-MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
+void MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
{
assert(mPos + 3 <= mLength);
@@ -119,8 +115,7 @@ MessageIn::readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction)
mPos += 3;
}
-void
-MessageIn::readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
+void MessageIn::readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
Uint16 &dstX, Uint16 &dstY)
{
assert(mPos + 5 <= mLength);
@@ -142,15 +137,13 @@ MessageIn::readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
mPos += 5;
}
-void
-MessageIn::skip(unsigned int length)
+void MessageIn::skip(unsigned int length)
{
assert(mPos + length <= mLength);
mPos += length;
}
-std::string
-MessageIn::readString(int length)
+std::string MessageIn::readString(int length)
{
// Get string length
if (length < 0) {
diff --git a/src/net/messagein.h b/src/net/messagein.h
index 81db6cdc..90804497 100644
--- a/src/net/messagein.h
+++ b/src/net/messagein.h
@@ -43,14 +43,12 @@ class MessageIn
/**
* Returns the message ID.
*/
- short
- getId() { return mId; }
+ short getId() { return mId; }
/**
* Returns the message length.
*/
- unsigned int
- getLength() { return mLength; }
+ unsigned int getLength() { return mLength; }
Sint8 readInt8(); /**< Reads a byte. */
Sint16 readInt16(); /**< Reads a short. */
@@ -60,30 +58,26 @@ class MessageIn
* Reads a special 3 byte block used by eAthena, containing x and y
* coordinates and direction.
*/
- void
- readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction);
+ void readCoordinates(Uint16 &x, Uint16 &y, Uint8 &direction);
/**
* Reads a special 5 byte block used by eAthena, containing a source
* and destination coordinate pair.
*/
- void
- readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
- Uint16 &dstX, Uint16 &dstY);
+ void readCoordinatePair(Uint16 &srcX, Uint16 &srcY,
+ Uint16 &dstX, Uint16 &dstY);
/**
* Skips a given number of bytes.
*/
- void
- skip(unsigned int length);
+ void skip(unsigned int length);
/**
* Reads a string. If a length is not given (-1), it is assumed
* that the length of the string is stored in a short at the
* start of the string.
*/
- std::string
- readString(int length = -1);
+ std::string readString(int length = -1);
private:
const char* mData; /**< The message data. */
diff --git a/src/net/network.cpp b/src/net/network.cpp
index c9f8d1bd..60d54a7a 100644
--- a/src/net/network.cpp
+++ b/src/net/network.cpp
@@ -431,8 +431,7 @@ char *iptostring(int address)
return asciiIP;
}
-void
-Network::setError(const std::string& error)
+void Network::setError(const std::string& error)
{
logger->log("Network error: %s", error.c_str());
mError = error;
diff --git a/src/net/network.h b/src/net/network.h
index 43b4dbbc..6270e0de 100644
--- a/src/net/network.h
+++ b/src/net/network.h
@@ -46,47 +46,33 @@ class Network
~Network();
- bool
- connect(const std::string &address, short port);
+ bool connect(const std::string &address, short port);
- void
- disconnect();
+ void disconnect();
- void
- registerHandler(MessageHandler *handler);
+ void registerHandler(MessageHandler *handler);
- void
- unregisterHandler(MessageHandler *handler);
+ void unregisterHandler(MessageHandler *handler);
- void
- clearHandlers();
+ void clearHandlers();
- int
- getState() const { return mState; }
+ int getState() const { return mState; }
- const std::string&
- getError() const { return mError; }
+ const std::string& getError() const { return mError; }
- bool
- isConnected() const { return mState == CONNECTED; }
+ bool isConnected() const { return mState == CONNECTED; }
- int
- getInSize() const { return mInSize; }
+ int getInSize() const { return mInSize; }
- void
- skip(int len);
+ void skip(int len);
- bool
- messageReady();
+ bool messageReady();
- MessageIn
- getNextMessage();
+ MessageIn getNextMessage();
- void
- dispatchMessages();
+ void dispatchMessages();
- void
- flush();
+ void flush();
// ERROR replaced by NET_ERROR because already defined in Windows
enum {
@@ -98,17 +84,13 @@ class Network
};
protected:
- void
- setError(const std::string& error);
+ void setError(const std::string& error);
- Uint16
- readWord(int pos);
+ Uint16 readWord(int pos);
- bool
- realConnect();
+ bool realConnect();
- void
- receive();
+ void receive();
TCPsocket mSocket;
diff --git a/src/net/partyhandler.cpp b/src/net/partyhandler.cpp
index 9b5f3080..d4b7455b 100644
--- a/src/net/partyhandler.cpp
+++ b/src/net/partyhandler.cpp
@@ -50,8 +50,7 @@ PartyHandler::PartyHandler(Party *party) : mParty(party)
handledMessages = _messages;
}
-void
-PartyHandler::handleMessage(MessageIn *msg)
+void PartyHandler::handleMessage(MessageIn *msg)
{
switch (msg->getId())
{
diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp
index 83b26743..59c7d0d6 100644
--- a/src/net/playerhandler.cpp
+++ b/src/net/playerhandler.cpp
@@ -264,7 +264,7 @@ void PlayerHandler::handleMessage(MessageIn *msg)
Uint32 curGp = player_node->mGp;
player_node->mGp = msg->readInt32();
if (player_node->mGp > curGp)
- chatWindow->chatLog("You picked up " +
+ chatWindow->chatLog(_("You picked up ") +
toString(player_node->mGp - curGp) + " GP",
BY_SERVER);
}
diff --git a/src/net/tradehandler.cpp b/src/net/tradehandler.cpp
index 746e1d06..07134746 100644
--- a/src/net/tradehandler.cpp
+++ b/src/net/tradehandler.cpp
@@ -32,6 +32,8 @@
#include "../gui/confirm_dialog.h"
#include "../gui/trade.h"
+#include "../utils/gettext.h"
+
std::string tradePartnerName;
/**
@@ -86,9 +88,9 @@ void TradeHandler::handleMessage(MessageIn *msg)
player_node->setTrading(true);
ConfirmDialog *dlg;
- dlg = new ConfirmDialog("Request for trade",
+ dlg = new ConfirmDialog(_("Request for trade"),
tradePartnerName +
- " wants to trade with you, do you accept?");
+ _(" wants to trade with you, do you accept?"));
dlg->addActionListener(&listener);
}
else
@@ -102,37 +104,35 @@ void TradeHandler::handleMessage(MessageIn *msg)
switch (msg->readInt8())
{
case 0: // Too far away
- chatWindow->chatLog("Trading isn't possible. "
- "Trade partner is too far away.",
+ chatWindow->chatLog(_("Trading isn't possible. Trade partner is too far away."),
BY_SERVER);
break;
case 1: // Character doesn't exist
- chatWindow->chatLog("Trading isn't possible. "
- "Character doesn't exist.",
+ chatWindow->chatLog(_("Trading isn't possible. Character doesn't exist."),
BY_SERVER);
break;
case 2: // Invite request check failed...
- chatWindow->chatLog("Trade cancelled due to an "
- "unknown reason.", BY_SERVER);
+ chatWindow->chatLog(_("Trade cancelled due to an unknown reason."),
+ BY_SERVER);
break;
case 3: // Trade accepted
tradeWindow->reset();
tradeWindow->setCaption(
- "Trade: You and " + tradePartnerName);
+ _("Trade: You and ") + tradePartnerName);
tradeWindow->setVisible(true);
break;
case 4: // Trade cancelled
if (player_relations.hasPermission(tradePartnerName,
PlayerRelation::SPEECH_LOG))
- chatWindow->chatLog("Trade with " + tradePartnerName +
- " cancelled", BY_SERVER);
+ chatWindow->chatLog(_("Trade with ") + tradePartnerName +
+ _(" cancelled"), BY_SERVER);
// otherwise ignore silently
tradeWindow->setVisible(false);
player_node->setTrading(false);
break;
default: // Shouldn't happen as well, but to be sure
- chatWindow->chatLog("Unhandled trade cancel packet",
+ chatWindow->chatLog(_("Unhandled trade cancel packet"),
BY_SERVER);
break;
}
@@ -182,19 +182,17 @@ void TradeHandler::handleMessage(MessageIn *msg)
break;
case 1:
// Add item failed - player overweighted
- chatWindow->chatLog("Failed adding item. Trade "
- "partner is over weighted.",
+ chatWindow->chatLog(_("Failed adding item. Trade partner is over weighted."),
BY_SERVER);
break;
case 2:
// Add item failed - player has no free slot
- chatWindow->chatLog("Failed adding item. Trade "
- "partner has no free slot.",
+ chatWindow->chatLog(_("Failed adding item. Trade partner has no free slot."),
BY_SERVER);
break;
default:
- chatWindow->chatLog("Failed adding item for "
- "unknown reason.", BY_SERVER);
+ chatWindow->chatLog(_("Failed adding item for unknown reason."),
+ BY_SERVER);
break;
}
}
@@ -206,14 +204,14 @@ void TradeHandler::handleMessage(MessageIn *msg)
break;
case SMSG_TRADE_CANCEL:
- chatWindow->chatLog("Trade canceled.", BY_SERVER);
+ chatWindow->chatLog(_("Trade canceled."), BY_SERVER);
tradeWindow->setVisible(false);
tradeWindow->reset();
player_node->setTrading(false);
break;
case SMSG_TRADE_COMPLETE:
- chatWindow->chatLog("Trade completed.", BY_SERVER);
+ chatWindow->chatLog(_("Trade completed."), BY_SERVER);
tradeWindow->setVisible(false);
tradeWindow->reset();
player_node->setTrading(false);
diff --git a/src/npc.cpp b/src/npc.cpp
index 2aa15209..a2fb7d38 100644
--- a/src/npc.cpp
+++ b/src/npc.cpp
@@ -111,8 +111,7 @@ NPC::getType() const
return Being::NPC;
}
-void
-NPC::talk()
+void NPC::talk()
{
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_TALK);
@@ -121,16 +120,14 @@ NPC::talk()
current_npc = this;
}
-void
-NPC::nextDialog()
+void NPC::nextDialog()
{
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_NEXT_REQUEST);
outMsg.writeInt32(mId);
}
-void
-NPC::dialogChoice(char choice)
+void NPC::dialogChoice(char choice)
{
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_LIST_CHOICE);
@@ -142,8 +139,7 @@ NPC::dialogChoice(char choice)
* TODO Unify the buy() and sell() methods, without sacrificing readability of
* the code calling the method. buy(bool buySell) would be bad...
*/
-void
-NPC::buy()
+void NPC::buy()
{
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_BUY_SELL_REQUEST);
@@ -151,8 +147,7 @@ NPC::buy()
outMsg.writeInt8(0);
}
-void
-NPC::sell()
+void NPC::sell()
{
MessageOut outMsg(mNetwork);
outMsg.writeInt16(CMSG_NPC_BUY_SELL_REQUEST);
diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp
index fbfb1505..b90db9f1 100644
--- a/src/particlecontainer.cpp
+++ b/src/particlecontainer.cpp
@@ -36,8 +36,7 @@ ParticleContainer::~ParticleContainer()
delete mNext;
}
-void
-ParticleContainer::clear()
+void ParticleContainer::clear()
{
clearLocally();
if (mNext)
@@ -57,8 +56,7 @@ ParticleList::ParticleList(ParticleContainer *parent, bool delParent) :
ParticleList::~ParticleList() {}
-void
-ParticleList::addLocally(Particle *particle)
+void ParticleList::addLocally(Particle *particle)
{
if (particle)
{
@@ -68,8 +66,7 @@ ParticleList::addLocally(Particle *particle)
}
}
-void
-ParticleList::removeLocally(Particle *particle)
+void ParticleList::removeLocally(Particle *particle)
{
for (std::list<Particle *>::iterator it = mElements.begin();
it != mElements.end(); it++)
@@ -79,8 +76,7 @@ ParticleList::removeLocally(Particle *particle)
}
}
-void
-ParticleList::clearLocally()
+void ParticleList::clearLocally()
{
for (std::list<Particle *>::iterator it = mElements.begin();
it != mElements.end(); it++)
@@ -117,8 +113,7 @@ ParticleVector::ParticleVector(ParticleContainer *parent, bool delParent) :
ParticleVector::~ParticleVector() {};
-void
-ParticleVector::setLocally(int index, Particle *particle)
+void ParticleVector::setLocally(int index, Particle *particle)
{
assert(index >= 0);
@@ -130,8 +125,7 @@ ParticleVector::setLocally(int index, Particle *particle)
mIndexedElements[index] = particle;
}
-void
-ParticleVector::delLocally(int index)
+void ParticleVector::delLocally(int index)
{
assert(index >= 0);
@@ -146,8 +140,7 @@ ParticleVector::delLocally(int index)
}
}
-void
-ParticleVector::clearLocally()
+void ParticleVector::clearLocally()
{
for (unsigned int i = 0; i < mIndexedElements.size(); i++)
delLocally(i);
diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp
index bdfaa5ba..fef34b22 100644
--- a/src/particleemitter.cpp
+++ b/src/particleemitter.cpp
@@ -329,8 +329,7 @@ ParticleEmitter::readParticleEmitterProp(xmlNodePtr propertyNode, T def)
}
-std::list<Particle *>
-ParticleEmitter::createParticles(int tick)
+std::list<Particle *> ParticleEmitter::createParticles(int tick)
{
std::list<Particle *> newParticles;
diff --git a/src/particleemitter.h b/src/particleemitter.h
index 809a6ded..e16ee241 100644
--- a/src/particleemitter.h
+++ b/src/particleemitter.h
@@ -70,8 +70,7 @@ class ParticleEmitter
/**
* Sets the target of the particles that are created
*/
- void
- setTarget(Particle *target)
+ void setTarget(Particle *target)
{ mParticleTarget = target; };
private:
diff --git a/src/player_relations.cpp b/src/player_relations.cpp
index ef00a738..5eb47433 100644
--- a/src/player_relations.cpp
+++ b/src/player_relations.cpp
@@ -91,8 +91,7 @@ PlayerRelationsManager::PlayerRelationsManager() :
{
}
-void
-PlayerRelationsManager::clear()
+void PlayerRelationsManager::clear()
{
std::vector<std::string> *names = getPlayers();
for (std::vector<std::string>::const_iterator
@@ -105,8 +104,7 @@ PlayerRelationsManager::clear()
#define PLAYER_IGNORE_STRATEGY "player-ignore-strategy"
#define DEFAULT_PERMISSIONS "default-player-permissions"
-int
-PlayerRelationsManager::getPlayerIgnoreStrategyIndex(const std::string &name)
+int PlayerRelationsManager::getPlayerIgnoreStrategyIndex(const std::string &name)
{
std::vector<PlayerIgnoreStrategy *> *strategies = getPlayerIgnoreStrategies();
for (unsigned int i = 0; i < strategies->size(); i++)
@@ -116,8 +114,7 @@ PlayerRelationsManager::getPlayerIgnoreStrategyIndex(const std::string &name)
return -1;
}
-void
-PlayerRelationsManager::load()
+void PlayerRelationsManager::load()
{
clear();
@@ -134,8 +131,7 @@ PlayerRelationsManager::load()
}
-void
-PlayerRelationsManager::init()
+void PlayerRelationsManager::init()
{
load();
@@ -143,8 +139,7 @@ PlayerRelationsManager::init()
clear(); // Yes, we still keep them around in the config file until the next update.
}
-void
-PlayerRelationsManager::store()
+void PlayerRelationsManager::store()
{
config.setList<std::map<std::string, PlayerRelation *>::const_iterator,
std::pair<std::string, PlayerRelation *>,
@@ -161,8 +156,7 @@ PlayerRelationsManager::store()
config.write();
}
-void
-PlayerRelationsManager::signalUpdate(const std::string &name)
+void PlayerRelationsManager::signalUpdate(const std::string &name)
{
store();
@@ -170,8 +164,7 @@ PlayerRelationsManager::signalUpdate(const std::string &name)
(*it)->updatedPlayer(name);
}
-unsigned int
-PlayerRelationsManager::checkPermissionSilently(const std::string &player_name, unsigned int flags)
+unsigned int PlayerRelationsManager::checkPermissionSilently(const std::string &player_name, unsigned int flags)
{
PlayerRelation *r = mRelations[player_name];
if (!r)
@@ -196,16 +189,14 @@ PlayerRelationsManager::checkPermissionSilently(const std::string &player_name,
}
}
-bool
-PlayerRelationsManager::hasPermission(Being *being, unsigned int flags)
+bool PlayerRelationsManager::hasPermission(Being *being, unsigned int flags)
{
if (being->getType() == Being::PLAYER)
return hasPermission(being->getName(), flags) == flags;
return true;
}
-bool
-PlayerRelationsManager::hasPermission(const std::string &name, unsigned int flags)
+bool PlayerRelationsManager::hasPermission(const std::string &name, unsigned int flags)
{
unsigned int rejections = flags & ~checkPermissionSilently(name, flags);
bool permitted = rejections == 0;
@@ -224,8 +215,7 @@ PlayerRelationsManager::hasPermission(const std::string &name, unsigned int flag
return permitted;
}
-void
-PlayerRelationsManager::setRelation(const std::string &player_name, PlayerRelation::relation relation)
+void PlayerRelationsManager::setRelation(const std::string &player_name, PlayerRelation::relation relation)
{
PlayerRelation *r = mRelations[player_name];
if (r == NULL)
@@ -236,8 +226,7 @@ PlayerRelationsManager::setRelation(const std::string &player_name, PlayerRelati
signalUpdate(player_name);
}
-std::vector<std::string> *
-PlayerRelationsManager::getPlayers()
+std::vector<std::string> * PlayerRelationsManager::getPlayers()
{
std::vector<std::string> *retval = new std::vector<std::string>();
@@ -250,8 +239,7 @@ PlayerRelationsManager::getPlayers()
return retval;
}
-void
-PlayerRelationsManager::removePlayer(const std::string &name)
+void PlayerRelationsManager::removePlayer(const std::string &name)
{
if (mRelations[name])
delete mRelations[name];
@@ -262,8 +250,7 @@ PlayerRelationsManager::removePlayer(const std::string &name)
}
-PlayerRelation::relation
-PlayerRelationsManager::getRelation(const std::string &name)
+PlayerRelation::relation PlayerRelationsManager::getRelation(const std::string &name)
{
if (mRelations[name])
return mRelations[name]->mRelation;
@@ -274,14 +261,12 @@ PlayerRelationsManager::getRelation(const std::string &name)
////////////////////////////////////////
// defaults
-unsigned int
-PlayerRelationsManager::getDefault() const
+unsigned int PlayerRelationsManager::getDefault() const
{
return mDefaultPermissions;
}
-void
-PlayerRelationsManager::setDefault(unsigned int permissions)
+void PlayerRelationsManager::setDefault(unsigned int permissions)
{
mDefaultPermissions = permissions;
@@ -303,8 +288,7 @@ public:
mShortName = PLAYER_IGNORE_STRATEGY_NOP;
}
- virtual void
- ignore(Player *player, unsigned int flags)
+ virtual void ignore(Player *player, unsigned int flags)
{
}
};
@@ -318,8 +302,7 @@ public:
mShortName = "dotdotdot";
}
- virtual void
- ignore(Player *player, unsigned int flags)
+ virtual void ignore(Player *player, unsigned int flags)
{
player->setSpeech("...", 5);
}
@@ -335,8 +318,7 @@ public:
mShortName = "blinkname";
}
- virtual void
- ignore(Player *player, unsigned int flags)
+ virtual void ignore(Player *player, unsigned int flags)
{
player->flash(200);
}
@@ -352,8 +334,7 @@ public:
mShortName = shortname;
}
- virtual void
- ignore(Player *player, unsigned int flags)
+ virtual void ignore(Player *player, unsigned int flags)
{
player->setEmote(mEmotion, IGNORE_EMOTE_TIME);
}
diff --git a/src/properties.h b/src/properties.h
index 86fffea3..038acd91 100644
--- a/src/properties.h
+++ b/src/properties.h
@@ -46,8 +46,7 @@ class Properties
* @return the value of the given property or the given default when it
* doesn't exist.
*/
- const std::string&
- getProperty(const std::string &name, const std::string &def = "") const
+ const std::string& getProperty(const std::string &name, const std::string &def = "") const
{
PropertyMap::const_iterator i = mProperties.find(name);
return (i != mProperties.end()) ? i->second : def;
@@ -81,8 +80,7 @@ class Properties
* @return <code>true</code> when a property is defined,
* <code>false</code> otherwise.
*/
- bool
- hasProperty(const std::string &name) const
+ bool hasProperty(const std::string &name) const
{
return (mProperties.find(name) != mProperties.end());
}
@@ -93,8 +91,7 @@ class Properties
* @param name The name of the property.
* @param value The value of the property.
*/
- void
- setProperty(const std::string &name, const std::string &value)
+ void setProperty(const std::string &name, const std::string &value)
{
mProperties[name] = value;
}
diff --git a/src/resources/action.h b/src/resources/action.h
index 09eb066e..5f159a00 100644
--- a/src/resources/action.h
+++ b/src/resources/action.h
@@ -44,11 +44,9 @@ class Action
*/
~Action();
- void
- setAnimation(int direction, Animation *animation);
+ void setAnimation(int direction, Animation *animation);
- Animation*
- getAnimation(int direction) const;
+ Animation* getAnimation(int direction) const;
protected:
typedef std::map<int, Animation*> Animations;
diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp
index 596c5fac..5721c7f0 100644
--- a/src/resources/animation.cpp
+++ b/src/resources/animation.cpp
@@ -30,22 +30,19 @@ Animation::Animation():
{
}
-void
-Animation::addFrame(Image *image, unsigned int delay, int offsetX, int offsetY)
+void Animation::addFrame(Image *image, unsigned int delay, int offsetX, int offsetY)
{
Frame frame = { image, delay, offsetX, offsetY };
mFrames.push_back(frame);
mDuration += delay;
}
-void
-Animation::addTerminator()
+void Animation::addTerminator()
{
addFrame(NULL, 0, 0, 0);
}
-bool
-Animation::isTerminator(const Frame &candidate)
+bool Animation::isTerminator(const Frame &candidate)
{
return (candidate.image == NULL);
}
diff --git a/src/resources/animation.h b/src/resources/animation.h
index 8dfe8614..93e100bd 100644
--- a/src/resources/animation.h
+++ b/src/resources/animation.h
@@ -54,39 +54,33 @@ class Animation
/**
* Appends a new animation at the end of the sequence.
*/
- void
- addFrame(Image *image, unsigned int delay, int offsetX, int offsetY);
+ void addFrame(Image *image, unsigned int delay, int offsetX, int offsetY);
/**
* Appends an animation terminator that states that the animation
* should not loop.
*/
- void
- addTerminator();
+ void addTerminator();
/**
* Returns the frame at the specified index.
*/
- Frame*
- getFrame(int index) { return &(mFrames[index]); }
+ Frame* getFrame(int index) { return &(mFrames[index]); }
/**
* Returns the length of this animation in frames.
*/
- unsigned int
- getLength() const { return mFrames.size(); }
+ unsigned int getLength() const { return mFrames.size(); }
/**
* Returns the duration of this animation.
*/
- int
- getDuration() const { return mDuration; }
+ int getDuration() const { return mDuration; }
/**
* Determines whether the given animation frame is a terminator.
*/
- static bool
- isTerminator(const Frame &phase);
+ static bool isTerminator(const Frame &phase);
protected:
std::vector<Frame> mFrames;
diff --git a/src/resources/buddylist.cpp b/src/resources/buddylist.cpp
index 1bd98680..8c02735a 100644
--- a/src/resources/buddylist.cpp
+++ b/src/resources/buddylist.cpp
@@ -111,7 +111,7 @@ bool BuddyList::removeBuddy(const std::string buddy)
return false;
}
-int BuddyList::getNumberOfElements()
+int BuddyList::getNumberOfElements()
{
return mBuddylist.size();
}
diff --git a/src/resources/buddylist.h b/src/resources/buddylist.h
index 6a3de8c4..092abc6a 100644
--- a/src/resources/buddylist.h
+++ b/src/resources/buddylist.h
@@ -52,7 +52,7 @@ class BuddyList : public gcn::ListModel {
/**
* Returns the number of buddy on the list
*/
- int getNumberOfElements();
+ int getNumberOfElements();
/**
* Returns the buddy of the number or null
diff --git a/src/resources/colordb.cpp b/src/resources/colordb.cpp
index bdc6211a..f80ca6b3 100644
--- a/src/resources/colordb.cpp
+++ b/src/resources/colordb.cpp
@@ -27,6 +27,7 @@
#include "../log.h"
#include "../utils/dtor.h"
+#include "../utils/gettext.h"
#include "../utils/xml.h"
#define HAIR_COLOR_FILE "colors.xml"
@@ -52,7 +53,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;
@@ -62,7 +63,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;
@@ -79,7 +80,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") :
@@ -94,7 +95,7 @@ void ColorDB::load()
void ColorDB::unload()
{
- logger->log("Unloading color database...");
+ logger->log(_("Unloading color database..."));
mColors.clear();
mLoaded = false;
@@ -109,7 +110,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/image.h b/src/resources/image.h
index 6eb33ed9..a2e52d3d 100644
--- a/src/resources/image.h
+++ b/src/resources/image.h
@@ -55,8 +55,7 @@ class Image : public Resource
/**
* Destructor.
*/
- virtual
- ~Image();
+ virtual ~Image();
/**
* Loads an image from a buffer in memory.
@@ -89,21 +88,17 @@ class Image : public Resource
/**
* Frees the resources created by SDL.
*/
- virtual void
- unload();
+ virtual void unload();
/**
* Returns the width of the image.
*/
- virtual int
- getWidth() const { return mBounds.w; }
-
+ virtual int getWidth() const { return mBounds.w; }
/**
* Returns the height of the image.
*/
- virtual int
- getHeight() const { return mBounds.h; }
+ virtual int getHeight() const { return mBounds.h; }
/**
* Creates a new image with the desired clipping rectangle.
@@ -111,20 +106,17 @@ class Image : public Resource
* @return <code>NULL</code> if creation failed and a valid
* object otherwise.
*/
- virtual Image*
- getSubImage(int x, int y, int width, int height);
+ virtual Image* getSubImage(int x, int y, int width, int height);
/**
* Sets the alpha value of this image.
*/
- void
- setAlpha(float alpha);
+ void setAlpha(float alpha);
/**
* Returns the alpha value of this image.
*/
- float
- getAlpha();
+ float getAlpha();
#ifdef USE_OPENGL
/**
@@ -134,7 +126,6 @@ class Image : public Resource
static void setLoadAsOpenGL(bool useOpenGL);
#endif
-
protected:
/**
* Constructor.
@@ -146,8 +137,7 @@ class Image : public Resource
/**
* Returns the first power of two equal or bigger than the input.
*/
- static int
- powerOfTwo(int input);
+ static int powerOfTwo(int input);
#endif
Image(SDL_Surface *image);
@@ -193,8 +183,7 @@ class SubImage : public Image
* @return <code>NULL</code> if creation failed and a valid
* image otherwise.
*/
- Image*
- getSubImage(int x, int y, int width, int height);
+ Image* getSubImage(int x, int y, int width, int height);
private:
Image *mParent;
diff --git a/src/resources/imagewriter.h b/src/resources/imagewriter.h
index 632e2ae4..0dcc0c33 100644
--- a/src/resources/imagewriter.h
+++ b/src/resources/imagewriter.h
@@ -27,5 +27,5 @@ class ImageWriter
{
public:
static bool writePNG(SDL_Surface *surface,
- const std::string &filename);
+ const std::string &filename);
};
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index 027b9e16..270083ef 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -49,10 +49,10 @@ void ItemDB::load()
if (mLoaded)
return;
- logger->log("Initializing item database...");
+ logger->log(_("Initializing item database..."));
mUnknown = new ItemInfo();
- mUnknown->setName("Unknown item");
+ mUnknown->setName(_("Unknown item"));
mUnknown->setImageName("");
mUnknown->setSprite("error.xml", GENDER_MALE);
mUnknown->setSprite("error.xml", GENDER_FEMALE);
@@ -62,7 +62,7 @@ void ItemDB::load()
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "items"))
{
- logger->error("ItemDB: Error while loading items.xml!");
+ logger->error(_("ItemDB: Error while loading items.xml!"));
}
for_each_xml_child_node(node, rootNode)
@@ -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);
}
int type = XML::getProperty(node, "type", 0);
@@ -139,7 +139,7 @@ void ItemDB::load()
void ItemDB::unload()
{
- logger->log("Unloading item database...");
+ logger->log(_("Unloading item database..."));
delete mUnknown;
mUnknown = NULL;
@@ -157,7 +157,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
@@ -196,7 +196,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/iteminfo.cpp b/src/resources/iteminfo.cpp
index 6f669376..4c04678a 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -22,8 +22,7 @@
#include "itemdb.h"
#include "iteminfo.h"
-const std::string&
-ItemInfo::getSprite(Gender gender) const
+const std::string& ItemInfo::getSprite(Gender gender) const
{
if (mView)
{
@@ -66,15 +65,12 @@ void ItemInfo::setWeaponType(int type)
}
}
-void
-ItemInfo::addSound(EquipmentSoundEvent event, const std::string &filename)
+void ItemInfo::addSound(EquipmentSoundEvent event, const std::string &filename)
{
mSounds[event].push_back("sfx/" + filename);
}
-
-const std::string&
-ItemInfo::getSound(EquipmentSoundEvent event) const
+const std::string& ItemInfo::getSound(EquipmentSoundEvent event) const
{
static const std::string empty;
std::map< EquipmentSoundEvent, std::vector<std::string> >::const_iterator i;
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index 7e2d7a1d..92009826 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -25,6 +25,7 @@
#include "../log.h"
#include "../utils/dtor.h"
+#include "../utils/gettext.h"
#include "../utils/xml.h"
namespace
@@ -34,23 +35,22 @@ namespace
bool mLoaded = false;
}
-void
-MonsterDB::load()
+void MonsterDB::load()
{
if (mLoaded)
return;
mUnknown.addSprite("error.xml");
- mUnknown.setName("unnamed");
+ mUnknown.setName(_("unnamed"));
- logger->log("Initializing monster database...");
+ logger->log(_("Initializing monster database..."));
XML::Document doc("monsters.xml");
xmlNodePtr rootNode = doc.rootNode();
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "monsters"))
{
- logger->error("Monster Database: Error while loading monster.xml!");
+ logger->error(_("Monster Database: Error while loading monster.xml!"));
}
//iterate <monster>s
@@ -81,7 +81,7 @@ 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);
}
@@ -118,7 +118,7 @@ MonsterDB::load()
}
else
{
- logger->log("MonsterDB: Warning, sound effect %s for unknown event %s of monster %s",
+ logger->log(_("MonsterDB: Warning, sound effect %s for unknown event %s of monster %s"),
filename, event.c_str(), currentInfo->getName().c_str());
}
}
@@ -156,7 +156,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/monsterdb.h b/src/resources/monsterdb.h
index f1d69e72..2e186c15 100644
--- a/src/resources/monsterdb.h
+++ b/src/resources/monsterdb.h
@@ -31,11 +31,9 @@
*/
namespace MonsterDB
{
- void
- load();
+ void load();
- void
- unload();
+ void unload();
const MonsterInfo& get(int id);
diff --git a/src/resources/monsterinfo.cpp b/src/resources/monsterinfo.cpp
index 4a71a122..faa759af 100644
--- a/src/resources/monsterinfo.cpp
+++ b/src/resources/monsterinfo.cpp
@@ -36,8 +36,7 @@ MonsterInfo::~MonsterInfo()
}
-void
-MonsterInfo::addSound(MonsterSoundEvent event, std::string filename)
+void MonsterInfo::addSound(MonsterSoundEvent event, std::string filename)
{
if (mSounds.find(event) == mSounds.end())
{
@@ -48,8 +47,7 @@ MonsterInfo::addSound(MonsterSoundEvent event, std::string filename)
}
-std::string
-MonsterInfo::getSound(MonsterSoundEvent event) const
+std::string MonsterInfo::getSound(MonsterSoundEvent event) const
{
std::map<MonsterSoundEvent, std::vector<std::string>* >::const_iterator i;
diff --git a/src/resources/monsterinfo.h b/src/resources/monsterinfo.h
index 05a78c5a..8d36cc06 100644
--- a/src/resources/monsterinfo.h
+++ b/src/resources/monsterinfo.h
@@ -56,43 +56,35 @@ class MonsterInfo
*/
~MonsterInfo();
- void
- setName(std::string name) { mName = name; }
+ void setName(std::string name) { mName = name; }
- void
- addSprite(std::string filename) { mSprites.push_back(filename); }
+ void addSprite(std::string filename) { mSprites.push_back(filename); }
- void
- setTargetCursorSize(Being::TargetCursorSize targetCursorSize)
+ void setTargetCursorSize(Being::TargetCursorSize targetCursorSize)
{ mTargetCursorSize = targetCursorSize; }
- void
- addSound(MonsterSoundEvent event, std::string filename);
+ void addSound(MonsterSoundEvent event, std::string filename);
- void
- addParticleEffect(std::string filename);
+ void addParticleEffect(std::string filename);
- const std::string&
- getName() const { return mName; }
+ const std::string& getName() const
+ { return mName; }
- const std::list<std::string>&
- getSprites() const { return mSprites; }
+ const std::list<std::string>& getSprites() const
+ { return mSprites; }
- Being::TargetCursorSize
- getTargetCursorSize() const { return mTargetCursorSize; }
+ Being::TargetCursorSize getTargetCursorSize() const
+ { return mTargetCursorSize; }
- std::string
- getSound(MonsterSoundEvent event) const;
+ std::string getSound(MonsterSoundEvent event) const;
- std::string
- getAttackParticleEffect() const { return mAttackParticle; }
+ std::string getAttackParticleEffect() const { return mAttackParticle; }
- void
- addAttackParticleEffect(const std::string &particleEffect)
+ void addAttackParticleEffect(const std::string &particleEffect)
{ mAttackParticle = particleEffect; }
- const std::list<std::string>&
- getParticleEffects() const { return mParticleEffects; }
+ const std::list<std::string>& getParticleEffects() const
+ { return mParticleEffects; }
private:
std::string mName;
diff --git a/src/resources/music.cpp b/src/resources/music.cpp
index 2386aa43..ed71d62c 100644
--- a/src/resources/music.cpp
+++ b/src/resources/music.cpp
@@ -55,8 +55,7 @@ Resource *Music::load(void *buffer, unsigned bufferSize)
}
}
-bool
-Music::play(int loops)
+bool Music::play(int loops)
{
/*
* Warning: loops should be always set to -1 (infinite) with current
@@ -71,8 +70,7 @@ Music::play(int loops)
return mChannel != -1;
}
-void
-Music::stop()
+void Music::stop()
{
/*
* Warning: very dungerous trick, it could try to stop channels occupied
diff --git a/src/resources/music.h b/src/resources/music.h
index d50150b8..322cfecd 100644
--- a/src/resources/music.h
+++ b/src/resources/music.h
@@ -56,14 +56,12 @@ class Music : public Resource
* @return <code>true</code> if the playback started properly
* <code>false</code> otherwise.
*/
- virtual bool
- play(int loops);
+ virtual bool play(int loops);
/**
* Stops the music.
*/
- virtual void
- stop();
+ virtual void stop();
protected:
/**
diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp
index 3ae58067..bfa22214 100644
--- a/src/resources/npcdb.cpp
+++ b/src/resources/npcdb.cpp
@@ -25,6 +25,7 @@
#include "../log.h"
#include "../utils/dtor.h"
+#include "../utils/gettext.h"
#include "../utils/xml.h"
namespace
@@ -44,14 +45,14 @@ 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();
if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "npcs"))
{
- logger->error("NPC Database: Error while loading items.xml!");
+ logger->error(_("NPC Database: Error while loading npcs.xml!"));
}
//iterate <monster>s
@@ -63,7 +64,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;
}
@@ -90,8 +91,7 @@ void NPCDB::load()
mLoaded = true;
}
-void
-NPCDB::unload()
+void NPCDB::unload()
{
for ( NPCInfosIterator i = mNPCInfos.begin();
i != mNPCInfos.end();
@@ -116,14 +116,13 @@ NPCDB::unload()
mLoaded = false;
}
-const NPCInfo&
-NPCDB::get(int id)
+const NPCInfo& NPCDB::get(int id)
{
NPCInfosIterator i = mNPCInfos.find(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/npcdb.h b/src/resources/npcdb.h
index b4539866..1883d747 100644
--- a/src/resources/npcdb.h
+++ b/src/resources/npcdb.h
@@ -45,11 +45,9 @@ typedef std::map<int, NPCInfo*> NPCInfos;
*/
namespace NPCDB
{
- void
- load();
+ void load();
- void
- unload();
+ void unload();
const NPCInfo& get(int id);
diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp
index e9310905..82562691 100644
--- a/src/resources/resource.cpp
+++ b/src/resources/resource.cpp
@@ -28,14 +28,12 @@ Resource::~Resource()
{
}
-void
-Resource::incRef()
+void Resource::incRef()
{
mRefCount++;
}
-void
-Resource::decRef()
+void Resource::decRef()
{
// Reference may not already have reached zero
assert(mRefCount != 0);
diff --git a/src/resources/resource.h b/src/resources/resource.h
index e85e3147..168fd70a 100644
--- a/src/resources/resource.h
+++ b/src/resources/resource.h
@@ -41,8 +41,7 @@ class Resource
/**
* Increments the internal reference count.
*/
- void
- incRef();
+ void incRef();
/**
* Decrements the reference count and deletes the object
@@ -51,8 +50,7 @@ class Resource
* @return <code>true</code> if the object was deleted
* <code>false</code> otherwise.
*/
- void
- decRef();
+ void decRef();
/**
* Return the path identifying this resource.
diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp
index a317e445..99b84506 100644
--- a/src/resources/resourcemanager.cpp
+++ b/src/resources/resourcemanager.cpp
@@ -418,8 +418,7 @@ void *ResourceManager::loadFile(const std::string &fileName, int &fileSize)
return buffer;
}
-std::vector<std::string>
-ResourceManager::loadTextFile(const std::string &fileName)
+std::vector<std::string> ResourceManager::loadTextFile(const std::string &fileName)
{
int contentsLength;
char *fileContents = (char*)loadFile(fileName, contentsLength);
diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp
index e21fd2b0..f7b2b874 100644
--- a/src/resources/soundeffect.cpp
+++ b/src/resources/soundeffect.cpp
@@ -47,8 +47,7 @@ Resource *SoundEffect::load(void *buffer, unsigned bufferSize)
}
}
-bool
-SoundEffect::play(int loops, int volume)
+bool SoundEffect::play(int loops, int volume)
{
Mix_VolumeChunk(mChunk, volume);
diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h
index c3ff6668..b9abefd7 100644
--- a/src/resources/soundeffect.h
+++ b/src/resources/soundeffect.h
@@ -58,8 +58,7 @@ class SoundEffect : public Resource
* @return <code>true</code> if the playback started properly
* <code>false</code> otherwise.
*/
- virtual bool
- play(int loops, int volume);
+ virtual bool play(int loops, int volume);
protected:
/**
diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp
index b4193fd3..41b1e789 100644
--- a/src/resources/spritedef.cpp
+++ b/src/resources/spritedef.cpp
@@ -32,8 +32,7 @@
#include "../log.h"
#include "../utils/xml.h"
-Action*
-SpriteDef::getAction(SpriteAction action) const
+Action* SpriteDef::getAction(SpriteAction action) const
{
Actions::const_iterator i = mActions.find(action);
@@ -146,8 +145,7 @@ void SpriteDef::loadImageSet(xmlNodePtr node, std::string const &palettes)
mImageSets[name] = imageSet;
}
-void
-SpriteDef::loadAction(xmlNodePtr node, int variant_offset)
+void SpriteDef::loadAction(xmlNodePtr node, int variant_offset)
{
const std::string actionName = XML::getProperty(node, "name", "");
const std::string imageSetName = XML::getProperty(node, "imageset", "");
@@ -187,10 +185,9 @@ SpriteDef::loadAction(xmlNodePtr node, int variant_offset)
}
}
-void
-SpriteDef::loadAnimation(xmlNodePtr animationNode,
- Action *action, ImageSet *imageSet,
- int variant_offset)
+void SpriteDef::loadAnimation(xmlNodePtr animationNode,
+ Action *action, ImageSet *imageSet,
+ int variant_offset)
{
const std::string directionName =
XML::getProperty(animationNode, "direction", "");
@@ -267,8 +264,7 @@ SpriteDef::loadAnimation(xmlNodePtr animationNode,
} // for frameNode
}
-void
-SpriteDef::includeSprite(xmlNodePtr includeNode)
+void SpriteDef::includeSprite(xmlNodePtr includeNode)
{
// TODO: Perform circular dependency check, since it's easy to crash the
// client this way.
@@ -289,8 +285,7 @@ SpriteDef::includeSprite(xmlNodePtr includeNode)
loadSprite(rootNode, 0);
}
-void
-SpriteDef::substituteAction(SpriteAction complete, SpriteAction with)
+void SpriteDef::substituteAction(SpriteAction complete, SpriteAction with)
{
if (mActions.find(complete) == mActions.end())
{
@@ -324,8 +319,7 @@ SpriteDef::~SpriteDef()
}
}
-SpriteAction
-SpriteDef::makeSpriteAction(const std::string& action)
+SpriteAction SpriteDef::makeSpriteAction(const std::string& action)
{
if (action == "" || action == "default") {
return ACTION_DEFAULT;
@@ -377,8 +371,7 @@ SpriteDef::makeSpriteAction(const std::string& action)
}
}
-SpriteDirection
-SpriteDef::makeSpriteDirection(const std::string& direction)
+SpriteDirection SpriteDef::makeSpriteDirection(const std::string& direction)
{
if (direction == "" || direction == "default") {
return DIRECTION_DEFAULT;
diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h
index 4b712340..033de6cd 100644
--- a/src/resources/spritedef.h
+++ b/src/resources/spritedef.h
@@ -103,22 +103,19 @@ class SpriteDef : public Resource
/**
* Loads an action element.
*/
- void
- loadAction(xmlNodePtr node, int variant_offset);
+ void loadAction(xmlNodePtr node, int variant_offset);
/**
* Loads an animation element.
*/
- void
- loadAnimation(xmlNodePtr animationNode,
- Action *action, ImageSet *imageSet,
- int variant_offset);
+ void loadAnimation(xmlNodePtr animationNode,
+ Action *action, ImageSet *imageSet,
+ int variant_offset);
/**
* Include another sprite into this one.
*/
- void
- includeSprite(xmlNodePtr includeNode);
+ void includeSprite(xmlNodePtr includeNode);
/**
* Complete missing actions by copying existing ones.
@@ -129,21 +126,17 @@ class SpriteDef : public Resource
* When there are no animations defined for the action "complete", its
* animations become a copy of those of the action "with".
*/
- void
- substituteAction(SpriteAction complete, SpriteAction with);
+ void substituteAction(SpriteAction complete, SpriteAction with);
/**
* Converts a string into a SpriteAction enum.
*/
- static SpriteAction
- makeSpriteAction(const std::string &action);
+ static SpriteAction makeSpriteAction(const std::string &action);
/**
* Converts a string into a SpriteDirection enum.
*/
- static SpriteDirection
- makeSpriteDirection(const std::string &direction);
-
+ static SpriteDirection makeSpriteDirection(const std::string &direction);
typedef std::map<std::string, ImageSet*> ImageSets;
typedef ImageSets::iterator ImageSetIterator;
diff --git a/src/sprite.h b/src/sprite.h
index 0e0a95db..52825db2 100644
--- a/src/sprite.h
+++ b/src/sprite.h
@@ -44,30 +44,26 @@ class Sprite
* would support setting a translation offset. It already does this
* partly with the clipping rectangle support.
*/
- virtual void
- draw(Graphics *graphics, int offsetX, int offsetY) const = 0;
+ virtual void draw(Graphics *graphics, int offsetX, int offsetY) const = 0;
/**
* Returns the horizontal size of the sprites graphical representation
* in pixels or 0 when it is undefined.
*/
- virtual int
- getWidth() const
+ virtual int getWidth() const
{ return 0; }
/**
* Returns the vertical size of the sprites graphical representation
* in pixels or 0 when it is undefined.
*/
- virtual int
- getHeight() const
+ virtual int getHeight() const
{ return 0; }
/**
* Returns the pixel Y coordinate of the sprite.
*/
- virtual int
- getPixelY() const = 0;
+ virtual int getPixelY() const = 0;
};
#endif
diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp
index e511ced3..db78d08c 100644
--- a/src/utils/xml.cpp
+++ b/src/utils/xml.cpp
@@ -61,8 +61,7 @@ namespace XML
return mDoc ? xmlDocGetRootElement(mDoc) : 0;
}
- int
- getProperty(xmlNodePtr node, const char* name, int def)
+ int getProperty(xmlNodePtr node, const char* name, int def)
{
int &ret = def;
@@ -75,8 +74,7 @@ namespace XML
return ret;
}
- double
- getFloatProperty(xmlNodePtr node, const char* name, double def)
+ double getFloatProperty(xmlNodePtr node, const char* name, double def)
{
double &ret = def;
@@ -89,8 +87,7 @@ namespace XML
return ret;
}
- std::string
- getProperty(xmlNodePtr node, const char *name, const std::string &def)
+ std::string getProperty(xmlNodePtr node, const char *name, const std::string &def)
{
xmlChar *prop = xmlGetProp(node, BAD_CAST name);
if (prop) {
diff --git a/src/utils/xml.h b/src/utils/xml.h
index 9e691963..403fe6d9 100644
--- a/src/utils/xml.h
+++ b/src/utils/xml.h
@@ -71,20 +71,17 @@ namespace XML
/**
* Gets an integer property from an xmlNodePtr.
*/
- int
- getProperty(xmlNodePtr node, const char *name, int def);
+ int getProperty(xmlNodePtr node, const char *name, int def);
/**
* Gets an floating point property from an xmlNodePtr.
*/
- double
- getFloatProperty(xmlNodePtr node, const char *name, double def);
+ double getFloatProperty(xmlNodePtr node, const char *name, double def);
/**
* Gets a string property from an xmlNodePtr.
*/
- std::string
- getProperty(xmlNodePtr node, const char *name, const std::string &def);
+ std::string getProperty(xmlNodePtr node, const char *name, const std::string &def);
/**
* Finds the first child node with the given name