From aff167beefadc32add4b44626cc2f1cbef800c7b Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 30 Jul 2006 14:33:28 +0000 Subject: Updated TMW to be compatible with Guichan 0.5.0 (merged from guichan-0.5.0 branch). --- src/gui/buy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/buy.h') diff --git a/src/gui/buy.h b/src/gui/buy.h index 0349be4a..b09b648b 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -71,7 +71,7 @@ class BuyDialog : public Window, public gcn::ActionListener /** * Called when receiving actions from the widgets. */ - void action(const std::string& eventId); + void action(const std::string& eventId, gcn::Widget* widget); /** * Returns the number of items in the shop inventory. -- cgit v1.2.3-70-g09d2 From 07b6070c25faedd78c2e26825bd700dc294f00cf Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sat, 26 Aug 2006 17:24:43 +0000 Subject: Made the Network class a purely static interface, as there is only one instance. --- ChangeLog | 9 +++++ src/beingmanager.cpp | 7 +--- src/beingmanager.h | 4 --- src/engine.cpp | 5 ++- src/engine.h | 4 +-- src/game.cpp | 42 +++++++++++------------ src/game.h | 5 +-- src/gui/buy.cpp | 4 +-- src/gui/buy.h | 4 +-- src/gui/char_select.cpp | 17 +++++----- src/gui/char_select.h | 8 ++--- src/gui/chat.cpp | 5 ++- src/gui/chat.h | 4 +-- src/gui/sell.cpp | 3 +- src/gui/sell.h | 4 +-- src/gui/trade.cpp | 3 +- src/gui/trade.h | 5 +-- src/localplayer.h | 4 --- src/main.cpp | 48 +++++++++++++------------- src/net/charserverhandler.cpp | 4 +-- src/net/messagehandler.cpp | 14 +------- src/net/messagehandler.h | 7 ---- src/net/network.cpp | 47 ++++++++++++++----------- src/net/network.h | 79 ++++++++++++++----------------------------- src/net/tradehandler.h | 2 -- src/npc.cpp | 4 +-- src/npc.h | 7 +--- 27 files changed, 136 insertions(+), 213 deletions(-) (limited to 'src/gui/buy.h') diff --git a/ChangeLog b/ChangeLog index 8e10286f..97782a6e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,15 @@ support for "say around" messages. * src/net/beinghandler.cpp: Partly implemented being creation, so that chat works. + * src/game.cpp, src/engine.h, src/beingmanager.h, src/gui/trade.cpp, + src/gui/sell.cpp, src/gui/char_select.cpp, src/gui/chat.h, + src/gui/buy.h, src/gui/chat.cpp, src/gui/char_select.h, + src/gui/buy.cpp, src/gui/sell.h, src/gui/trade.h, src/engine.cpp, + src/beingmanager.cpp, src/npc.cpp, src/main.cpp, src/npc.h, + src/net/tradehandler.h, src/net/messagehandler.h, src/net/network.h, + src/net/charserverhandler.cpp, src/net/messagehandler.cpp, + src/net/network.cpp, src/localplayer.h, src/game.h: Made the Network + class a purely static interface, as there is only one instance. 2006-08-21 Eugenio Favalli diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index 7a94859a..caecd88e 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -49,11 +49,6 @@ class FindBeingFunctor Being::Type type; } beingFinder; -BeingManager::BeingManager(Network *network): - mNetwork(network) -{ -} - void BeingManager::setMap(Map *map) { mMap = map; @@ -79,7 +74,7 @@ Being* BeingManager::createBeing(Uint32 id, Uint16 job) outMsg.writeLong(id); } else if (job >= 100 & job < 200) - being = new NPC(id, job, mMap, mNetwork); + being = new NPC(id, job, mMap); else if (job >= 1000 && job < 1200) being = new Monster(id, job, mMap); else diff --git a/src/beingmanager.h b/src/beingmanager.h index bb6fc99b..0dbafcc6 100644 --- a/src/beingmanager.h +++ b/src/beingmanager.h @@ -28,7 +28,6 @@ class LocalPlayer; class Map; -class Network; typedef std::list Beings; typedef Beings::iterator BeingIterator; @@ -36,8 +35,6 @@ typedef Beings::iterator BeingIterator; class BeingManager { public: - BeingManager(Network *network); - /** * Sets the map on which beings are created */ @@ -86,7 +83,6 @@ class BeingManager protected: Beings mBeings; Map *mMap; - Network *mNetwork; }; extern BeingManager *beingManager; diff --git a/src/engine.cpp b/src/engine.cpp index a6ce9533..3e6b091a 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -62,10 +62,9 @@ Spriteset *emotionset; Spriteset *npcset; std::vector weaponset; -Engine::Engine(Network *network): +Engine::Engine(): mShowDebugPath(false), - mCurrentMap(NULL), - mNetwork(network) + mCurrentMap(NULL) { // Load the sprite sets ResourceManager *resman = ResourceManager::getInstance(); diff --git a/src/engine.h b/src/engine.h index ff39cfba..bdf8419a 100644 --- a/src/engine.h +++ b/src/engine.h @@ -30,7 +30,6 @@ extern int camera_x, camera_y; class Graphics; class Map; -class Network; /** * Game engine that does the main drawing. @@ -41,7 +40,7 @@ class Engine /** * Constructor. */ - Engine(Network *network); + Engine(); /** * Destructor. @@ -77,7 +76,6 @@ class Engine bool mShowDebugPath; Map *mCurrentMap; - Network *mNetwork; }; extern Engine *engine; diff --git a/src/game.cpp b/src/game.cpp index b6428103..f83e9c1f 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -164,15 +164,15 @@ int get_elapsed_time(int start_time) /** * Create all the various globally accessible gui windows */ -void createGuiWindows(Network *network) +void createGuiWindows() { // Create dialogs - chatWindow = new ChatWindow(network); + chatWindow = new ChatWindow; menuWindow = new MenuWindow(); statusWindow = new StatusWindow(player_node); miniStatusWindow = new MiniStatusWindow(); - buyDialog = new BuyDialog(network); - sellDialog = new SellDialog(network); + buyDialog = new BuyDialog; + sellDialog = new SellDialog; buySellDialog = new BuySellDialog(); inventoryWindow = new InventoryWindow(); npcTextDialog = new NpcTextDialog(); @@ -183,7 +183,7 @@ void createGuiWindows(Network *network) minimap = new Minimap(); equipmentWindow = new EquipmentWindow(player_node->mEquipment.get()); chargeDialog = new ChargeDialog(); - tradeWindow = new TradeWindow(network); + tradeWindow = new TradeWindow; //buddyWindow = new BuddyWindow(); helpWindow = new HelpWindow(); debugWindow = new DebugWindow(); @@ -250,8 +250,7 @@ void destroyGuiWindows() delete debugWindow; } -Game::Game(Network *network): - mNetwork(network), +Game::Game(): mBeingHandler(new BeingHandler()), mBuySellHandler(new BuySellHandler()), mChatHandler(new ChatHandler()), @@ -263,10 +262,10 @@ Game::Game(Network *network): mSkillHandler(new SkillHandler()), mTradeHandler(new TradeHandler()) { - createGuiWindows(network); - engine = new Engine(network); + createGuiWindows(); + engine = new Engine; - beingManager = new BeingManager(network); + beingManager = new BeingManager; floorItemManager = new FloorItemManager(); // Initialize timers @@ -276,7 +275,6 @@ Game::Game(Network *network): // Initialize beings beingManager->setPlayer(player_node); - player_node->setNetwork(network); Joystick::init(); // TODO: The user should be able to choose which one to use @@ -286,16 +284,16 @@ Game::Game(Network *network): joystick = new Joystick(0); } - network->registerHandler(mBeingHandler.get()); - network->registerHandler(mBuySellHandler.get()); - network->registerHandler(mChatHandler.get()); - network->registerHandler(mEquipmentHandler.get()); - network->registerHandler(mInventoryHandler.get()); - network->registerHandler(mItemHandler.get()); - network->registerHandler(mNpcHandler.get()); - network->registerHandler(mPlayerHandler.get()); - network->registerHandler(mSkillHandler.get()); - network->registerHandler(mTradeHandler.get()); + Network::registerHandler(mBeingHandler.get()); + Network::registerHandler(mBuySellHandler.get()); + Network::registerHandler(mChatHandler.get()); + Network::registerHandler(mEquipmentHandler.get()); + Network::registerHandler(mInventoryHandler.get()); + Network::registerHandler(mItemHandler.get()); + Network::registerHandler(mNpcHandler.get()); + Network::registerHandler(mPlayerHandler.get()); + Network::registerHandler(mSkillHandler.get()); + Network::registerHandler(mTradeHandler.get()); } Game::~Game() @@ -374,7 +372,7 @@ void Game::logic() } // Handle network stuff - mNetwork->flush(); + Network::flush(); } } diff --git a/src/game.h b/src/game.h index a44c8970..7330052a 100644 --- a/src/game.h +++ b/src/game.h @@ -31,7 +31,6 @@ #define SPEECH_MAX_TIME 100 class MessageHandler; -class Network; extern std::string map_path; extern volatile int fps; @@ -40,7 +39,7 @@ extern volatile int tick_time; class Game { public: - Game(Network *network); + Game(); ~Game(); void logic(); @@ -48,8 +47,6 @@ class Game void handleInput(); protected: - Network *mNetwork; - typedef std::auto_ptr MessageHandlerPtr; MessageHandlerPtr mBeingHandler; MessageHandlerPtr mBuySellHandler; diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index e7bfef58..63a6e20e 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -42,8 +42,8 @@ #include "../utils/tostring.h" -BuyDialog::BuyDialog(Network *network): - Window("Buy"), mNetwork(network), +BuyDialog::BuyDialog(): + Window("Buy"), mMoney(0), mAmountItems(0), mMaxItems(0) { mShopItems = new ShopItems; diff --git a/src/gui/buy.h b/src/gui/buy.h index b09b648b..0ddea4c4 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -30,7 +30,6 @@ #include "../guichanfwd.h" -class Network; class ShopItems; /** @@ -46,7 +45,7 @@ class BuyDialog : public Window, public gcn::ActionListener * * @see Window::Window */ - BuyDialog(Network *network); + BuyDialog(); /** * Destructor @@ -89,7 +88,6 @@ class BuyDialog : public Window, public gcn::ActionListener std::string getElementAt(int i); private: - Network *mNetwork; gcn::Button *mBuyButton; gcn::Button *mQuitButton; gcn::Button *mIncreaseButton; diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 3db82287..7e0a1a29 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -71,9 +71,8 @@ void CharDeleteConfirm::action(const std::string &eventId, gcn::Widget *widget) ConfirmDialog::action(eventId, widget); } -CharSelectDialog::CharSelectDialog(Network *network, - LockedArray *charInfo): - Window("Select Character"), mNetwork(network), +CharSelectDialog::CharSelectDialog(LockedArray *charInfo): + Window("Select Character"), mCharInfo(charInfo), mCharSelected(false) { mSelectButton = new Button("Ok", "ok", this); @@ -147,7 +146,7 @@ void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget) { // Start new character dialog mCharInfo->lock(); - new CharCreateDialog(this, mCharInfo->getPos(), mNetwork); + new CharCreateDialog(this, mCharInfo->getPos()); mCharInfo->unlock(); } } @@ -208,7 +207,7 @@ void CharSelectDialog::attemptCharDelete() msg.writeShort(PAMSG_CHAR_DELETE); // TODO: Send the selected slot msg.writeByte(0); - network->send(Network::ACCOUNT, msg); + Network::send(Network::ACCOUNT, msg); mCharInfo->lock(); } @@ -218,7 +217,7 @@ void CharSelectDialog::attemptCharSelect() MessageOut msg; msg.writeShort(PAMSG_CHAR_SELECT); msg.writeByte(mCharInfo->getPos()); - network->send(Network::ACCOUNT, msg); + Network::send(Network::ACCOUNT, msg); mCharInfo->lock(); } @@ -227,8 +226,8 @@ void CharSelectDialog::logic() updatePlayerInfo(); } -CharCreateDialog::CharCreateDialog(Window *parent, int slot, Network *network): - Window("Create Character", true, parent), mNetwork(network), mSlot(slot) +CharCreateDialog::CharCreateDialog(Window *parent, int slot): + Window("Create Character", true, parent), mSlot(slot) { mNameField = new TextField(""); mNameLabel = new gcn::Label("Name:"); @@ -336,5 +335,5 @@ void CharCreateDialog::attemptCharCreate() outMsg.writeShort(10); // INT outMsg.writeShort(10); // DEX outMsg.writeShort(10); // LUK - network->send(Network::ACCOUNT, outMsg); + Network::send(Network::ACCOUNT, outMsg); } diff --git a/src/gui/char_select.h b/src/gui/char_select.h index e65f400d..73fc8b2d 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -32,7 +32,6 @@ #include class LocalPlayer; -class Network; class PlayerBox; /** @@ -47,8 +46,7 @@ class CharSelectDialog : public Window, public gcn::ActionListener /** * Constructor. */ - CharSelectDialog(Network *network, - LockedArray *charInfo); + CharSelectDialog(LockedArray *charInfo); void action(const std::string& eventId, gcn::Widget* widget); @@ -57,7 +55,6 @@ class CharSelectDialog : public Window, public gcn::ActionListener void logic(); private: - Network *mNetwork; LockedArray *mCharInfo; gcn::Button *mSelectButton; @@ -97,14 +94,13 @@ class CharCreateDialog : public Window, public gcn::ActionListener /** * Constructor. */ - CharCreateDialog(Window *parent, int slot, Network *network); + CharCreateDialog(Window *parent, int slot); void action(const std::string& eventId, gcn::Widget* widget); std::string getName(); private: - Network *mNetwork; gcn::TextField *mNameField; gcn::Label *mNameLabel; gcn::Button *mNextHairColorButton; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index e8bb1cc6..04ac3996 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -40,9 +40,8 @@ #include "../net/network.h" #include "../net/protocol.h" -ChatWindow::ChatWindow(Network *network): +ChatWindow::ChatWindow(): Window(""), - mNetwork(network), mTmpVisible(false) { setWindowName("Chat"); @@ -253,7 +252,7 @@ ChatWindow::chatSend(const std::string &nick, std::string msg) MessageOut outMsg; outMsg.writeShort(PGMSG_SAY); outMsg.writeString(msg); - network->send(Network::GAME, outMsg); + Network::send(Network::GAME, outMsg); } else if (msg.substr(0, IS_ANNOUNCE_LENGTH) == IS_ANNOUNCE) { diff --git a/src/gui/chat.h b/src/gui/chat.h index 20841873..a0a3d1ec 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -35,7 +35,6 @@ #include "../guichanfwd.h" class BrowserBox; -class Network; class ScrollArea; #define BY_GM 0 // those should be self-explanatory =) @@ -116,7 +115,7 @@ class ChatWindow : public Window, public gcn::ActionListener, /** * Constructor. */ - ChatWindow(Network *network); + ChatWindow(); /** * Logic (updates components' size) @@ -188,7 +187,6 @@ class ChatWindow : public Window, public gcn::ActionListener, void setVisible(bool visible); private: - Network *mNetwork; bool mTmpVisible; /** One item in the chat log */ diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index e820d42f..3aa7c889 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -44,9 +44,8 @@ #include "../utils/tostring.h" -SellDialog::SellDialog(Network *network): +SellDialog::SellDialog(): Window("Sell"), - mNetwork(network), mMaxItems(0), mAmountItems(0) { mShopItems = new ShopItems(); diff --git a/src/gui/sell.h b/src/gui/sell.h index 423fea26..be5185bd 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -31,7 +31,6 @@ #include "../guichanfwd.h" class Item; -class Network; class ShopItems; @@ -48,7 +47,7 @@ class SellDialog : public Window, public gcn::ActionListener * * @see Window::Window */ - SellDialog(Network *network); + SellDialog(); /** * Destructor @@ -76,7 +75,6 @@ class SellDialog : public Window, public gcn::ActionListener void mouseClick(int x, int y, int buton, int count); private: - Network *mNetwork; gcn::Button *mSellButton; gcn::Button *mIncreaseButton; gcn::Button *mDecreaseButton; diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 73193c88..6b247901 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -45,9 +45,8 @@ #include "../utils/tostring.h" -TradeWindow::TradeWindow(Network *network): +TradeWindow::TradeWindow(): Window("Trade: You"), - mNetwork(network), mMyInventory(new Inventory()), mPartnerInventory(new Inventory()) { diff --git a/src/gui/trade.h b/src/gui/trade.h index eb3c0f97..fe60aac5 100644 --- a/src/gui/trade.h +++ b/src/gui/trade.h @@ -35,7 +35,6 @@ class Inventory; class Item; class ItemContainer; -class Network; class ScrollArea; /** @@ -49,7 +48,7 @@ class TradeWindow : public Window, gcn::ActionListener /** * Constructor. */ - TradeWindow(Network *network); + TradeWindow(); /** * Destructor. @@ -113,8 +112,6 @@ class TradeWindow : public Window, gcn::ActionListener void action(const std::string& eventId, gcn::Widget* widget); private: - Network *mNetwork; - typedef std::auto_ptr InventoryPtr; InventoryPtr mMyInventory; InventoryPtr mPartnerInventory; diff --git a/src/localplayer.h b/src/localplayer.h index fdef6ba1..613f196a 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -34,7 +34,6 @@ class FloorItem; class Inventory; class Item; -class Network; class LocalPlayer : public Player { @@ -47,8 +46,6 @@ class LocalPlayer : public Player virtual ~LocalPlayer(); - void setNetwork(Network *network) { mNetwork = network; } - virtual void logic(); virtual void nextStep(); @@ -145,7 +142,6 @@ class LocalPlayer : public Player std::auto_ptr mInventory; protected: - Network *mNetwork; Being *mTarget; FloorItem *mPickUpTarget; diff --git a/src/main.cpp b/src/main.cpp index 4e65e4fc..573b1a79 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -413,8 +413,8 @@ MapLoginHandler mapLoginHandler; void accountLogin(LoginData *loginData) { logger->log("Username is %s", loginData->username.c_str()); - network->registerHandler(&loginHandler); - network->registerHandler(&charServerHandler); + Network::registerHandler(&loginHandler); + Network::registerHandler(&charServerHandler); loginHandler.setLoginData(loginData); charServerHandler.setLoginData(loginData); charServerHandler.setCharInfo(&charInfo); @@ -424,7 +424,7 @@ void accountLogin(LoginData *loginData) msg.writeLong(0); // client version msg.writeString(loginData->username); msg.writeString(loginData->password); - network->send(Network::ACCOUNT, msg); + Network::send(Network::ACCOUNT, msg); // Clear the password, avoids auto login when returning to login loginData->password = ""; @@ -441,7 +441,7 @@ void accountLogin(LoginData *loginData) void accountRegister(LoginData *loginData) { logger->log("Username is %s", loginData->username.c_str()); - network->registerHandler(&loginHandler); + Network::registerHandler(&loginHandler); loginHandler.setLoginData(loginData); charServerHandler.setLoginData(loginData); charServerHandler.setCharInfo(&charInfo); @@ -452,21 +452,21 @@ void accountRegister(LoginData *loginData) msg.writeString(loginData->username); msg.writeString(loginData->password); msg.writeString(loginData->email); - network->send(Network::ACCOUNT, msg); + Network::send(Network::ACCOUNT, msg); } -void mapLogin(Network *network, LoginData *loginData) +void mapLogin(LoginData *loginData) { - network->registerHandler(&mapLoginHandler); + Network::registerHandler(&mapLoginHandler); // Send connect messages with the magic token to game and chat servers MessageOut gameServerConnect(PGMSG_CONNECT); gameServerConnect.writeString(token, 32); - network->send(Network::GAME, gameServerConnect); + Network::send(Network::GAME, gameServerConnect); MessageOut chatServerConnect(PCMSG_CONNECT); chatServerConnect.writeString(token, 32); - network->send(Network::CHAT, chatServerConnect); + Network::send(Network::CHAT, chatServerConnect); } /** Main */ @@ -533,7 +533,7 @@ int main(int argc, char *argv[]) { logger->error("An error occurred while initializing ENet."); } - network = new Network(); + Network::initialize(); SDL_Event event; @@ -557,9 +557,9 @@ int main(int argc, char *argv[]) } gui->logic(); - network->flush(); + Network::flush(); - if (network->getState() == Network::NET_ERROR) + if (Network::getState() == Network::NET_ERROR) { state = STATE_ERROR; errorMessage = "Got disconnected from server!"; @@ -585,7 +585,7 @@ int main(int argc, char *argv[]) // TODO: Add connect timeout to go back to choose server if (state == STATE_CONNECT_ACCOUNT && - network->isConnected(Network::ACCOUNT)) + Network::isConnected(Network::ACCOUNT)) { if (options.skipUpdate) { state = STATE_LOGIN; @@ -594,8 +594,8 @@ int main(int argc, char *argv[]) } } else if (state == STATE_CONNECT_GAME && - network->isConnected(Network::GAME) && - network->isConnected(Network::CHAT)) + Network::isConnected(Network::GAME) && + Network::isConnected(Network::CHAT)) { // TODO: Somehow send the token state = STATE_GAME; @@ -611,7 +611,7 @@ int main(int argc, char *argv[]) // Disconnect from account server once connected to game server if (oldstate == STATE_CONNECT_GAME && state == STATE_GAME) { - network->disconnect(Network::ACCOUNT); + Network::disconnect(Network::ACCOUNT); } oldstate = state; @@ -627,7 +627,7 @@ int main(int argc, char *argv[]) logger->log("State: CHOOSE_SERVER"); // TODO: Allow changing this using a server choice dialog logger->log("Trying to connect to account server..."); - network->connect(Network::ACCOUNT, + Network::connect(Network::ACCOUNT, loginData.hostname, loginData.port); state = STATE_CONNECT_ACCOUNT; break; @@ -667,7 +667,7 @@ int main(int argc, char *argv[]) case STATE_CHAR_SELECT: logger->log("State: CHAR_SELECT"); - currentDialog = new CharSelectDialog(network, &charInfo); + currentDialog = new CharSelectDialog(&charInfo); if (options.chooseDefault) { ((CharSelectDialog*)currentDialog)->action("ok", NULL); @@ -679,9 +679,9 @@ int main(int argc, char *argv[]) currentDialog = new OkDialog("Error", errorMessage); currentDialog->addActionListener(&errorListener); currentDialog = NULL; // OkDialog deletes itself - network->disconnect(Network::GAME); - network->disconnect(Network::CHAT); - network->clearHandlers(); + Network::disconnect(Network::GAME); + Network::disconnect(Network::CHAT); + Network::clearHandlers(); break; case STATE_CONNECT_GAME: @@ -690,7 +690,7 @@ int main(int argc, char *argv[]) break; case STATE_GAME: - mapLogin(network, &loginData); + mapLogin(&loginData); sound.fadeOutMusic(1000); currentDialog = NULL; @@ -698,7 +698,7 @@ int main(int argc, char *argv[]) login_wallpaper = NULL; logger->log("State: GAME"); - game = new Game(network); + game = new Game; game->logic(); delete game; state = STATE_EXIT; @@ -711,7 +711,7 @@ int main(int argc, char *argv[]) } } - delete network; + Network::finalize(); enet_deinitialize(); if (nullFile) diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp index 1eea29b8..d67949cc 100644 --- a/src/net/charserverhandler.cpp +++ b/src/net/charserverhandler.cpp @@ -174,8 +174,8 @@ CharServerHandler::handleCharSelectResponse(MessageIn &msg) logger->log("Game server: %s:%d", gameServer.c_str(), gameServerPort); logger->log("Chat server: %s:%d", chatServer.c_str(), chatServerPort); - network->connect(Network::GAME, gameServer, gameServerPort); - network->connect(Network::CHAT, chatServer, chatServerPort); + Network::connect(Network::GAME, gameServer, gameServerPort); + Network::connect(Network::CHAT, chatServer, chatServerPort); // Keep the selected character and delete the others player_node = mCharInfo->getEntry(); diff --git a/src/net/messagehandler.cpp b/src/net/messagehandler.cpp index 849b6716..0b5cd87c 100644 --- a/src/net/messagehandler.cpp +++ b/src/net/messagehandler.cpp @@ -27,19 +27,7 @@ #include "network.h" -MessageHandler::MessageHandler(): - mNetwork(0) -{ -} - MessageHandler::~MessageHandler() { - if (mNetwork) - mNetwork->unregisterHandler(this); -} - -void MessageHandler::setNetwork(Network *network) -{ - assert(!(network && mNetwork)); - mNetwork = network; + Network::unregisterHandler(this); } diff --git a/src/net/messagehandler.h b/src/net/messagehandler.h index 9f92636d..b21abd72 100644 --- a/src/net/messagehandler.h +++ b/src/net/messagehandler.h @@ -27,22 +27,15 @@ #include class MessageIn; -class Network; class MessageHandler { public: const Uint16 *handledMessages; - MessageHandler(); virtual ~MessageHandler(); virtual void handleMessage(MessageIn &msg) = 0; - - void setNetwork(Network *network); - - protected: - Network *mNetwork; }; #endif diff --git a/src/net/network.cpp b/src/net/network.cpp index 08b5fe92..e56f6df0 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -29,10 +29,25 @@ #include "../log.h" -Network *network; +static Network::State mState; -Network::Network(): - mState(NET_OK) +/** + * The local host. + */ +static ENetHost *mClient; + +/** + * An array holding the peers of the account, game and chat servers. + */ +static ENetPeer *mServers[3]; + +typedef std::map MessageHandlers; +typedef MessageHandlers::iterator MessageHandlerIterator; +static MessageHandlers mMessageHandlers; + +Network::State Network::getState() { return mState; } + +void Network::initialize() { // Initialize server peers for (int i = 0; i < 3; ++i) @@ -48,7 +63,7 @@ Network::Network(): } } -Network::~Network() +void Network::finalize() { clearHandlers(); @@ -110,15 +125,10 @@ Network::disconnect(Server server) void Network::registerHandler(MessageHandler *handler) { - const Uint16 *i = handler->handledMessages; - - while(*i) + for (const Uint16 *i = handler->handledMessages; *i; i++) { mMessageHandlers[*i] = handler; - i++; } - - handler->setNetwork(this); } void @@ -128,30 +138,27 @@ Network::unregisterHandler(MessageHandler *handler) { mMessageHandlers.erase(*i); } - - handler->setNetwork(0); } void Network::clearHandlers() { - MessageHandlerIterator i; - for (i = mMessageHandlers.begin(); i != mMessageHandlers.end(); i++) - { - i->second->setNetwork(0); - } mMessageHandlers.clear(); } bool -Network::isConnected(Server server) const +Network::isConnected(Server server) { return mServers[server] != NULL && mServers[server]->state == ENET_PEER_STATE_CONNECTED; } -void -Network::dispatchMessage(ENetPacket *packet) +/** + * Dispatches a message to the appropriate message handler and + * destroys it afterwards. + */ +static void +dispatchMessage(ENetPacket *packet) { MessageIn msg((const char *)packet->data, packet->dataLength); diff --git a/src/net/network.h b/src/net/network.h index 40255e44..861fa2b3 100644 --- a/src/net/network.h +++ b/src/net/network.h @@ -42,108 +42,79 @@ class MessageOut; class Network { public: - friend class MessageOut; - /** - * Constructor. Sets up the local host. + * Sets up the local host. */ - Network(); + static void + initialize(); /** - * Destructor. + * Closes the connections. */ - ~Network(); + static void + finalize(); - typedef enum { + enum Server { ACCOUNT, GAME, CHAT - } Server; + }; + + enum State { + NET_OK, + NET_ERROR + }; /** * Connects to the given server with the specified address and port. * This method is non-blocking, use isConnected to check whether the * server is connected. */ - bool + static bool connect(Server server, const std::string &address, short port); /** * Disconnects from the given server. */ - void + static void disconnect(Server server); /** * Registers a message handler. A message handler handles a certain * subset of incoming messages. */ - void + static void registerHandler(MessageHandler *handler); /** * Unregisters a message handler. */ - void + static void unregisterHandler(MessageHandler *handler); - void + static void clearHandlers(); - int - getState() const { return mState; } + static State + getState(); /** * Returns whether the given server is connected. */ - bool - isConnected(Server server) const; + static bool + isConnected(Server server); - void + static void flush(); /** - * Send a message to a given server. The server should be connected. + * Sends a message to a given server. The server should be connected. */ - void + static void send(Server server, const MessageOut &msg); - - enum State { - NET_OK, - NET_ERROR - }; - - private: - /** - * The local host. - */ - ENetHost *mClient; - - /** - * An array holding the peers of the account, game and chat servers. - */ - ENetPeer *mServers[3]; - - /** - * Dispatches a message to the appropriate message handler and - * destroys it afterwards. - */ - void - dispatchMessage(ENetPacket *packet); - - unsigned int mToSkip; - - int mState; - - typedef std::map MessageHandlers; - typedef MessageHandlers::iterator MessageHandlerIterator; - MessageHandlers mMessageHandlers; }; /** Convert an address from int format to string */ char *iptostring(int address); -// TODO: remove this global, just a temp solution. -extern Network *network; - #endif diff --git a/src/net/tradehandler.h b/src/net/tradehandler.h index 0b73c871..1ab3c2e4 100644 --- a/src/net/tradehandler.h +++ b/src/net/tradehandler.h @@ -26,8 +26,6 @@ #include "messagehandler.h" -class Network; - class TradeHandler : public MessageHandler { public: diff --git a/src/npc.cpp b/src/npc.cpp index a82490ae..a14b6d24 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -33,8 +33,8 @@ extern Spriteset *npcset; NPC *current_npc = 0; -NPC::NPC(Uint32 id, Uint16 job, Map *map, Network *network): - Being(id, job, map), mNetwork(network) +NPC::NPC(Uint32 id, Uint16 job, Map *map): + Being(id, job, map) { mSprites[BASE_SPRITE] = new AnimatedSprite("graphics/sprites/npc.xml", job-100); } diff --git a/src/npc.h b/src/npc.h index b08c315c..bbc86d9c 100644 --- a/src/npc.h +++ b/src/npc.h @@ -26,12 +26,10 @@ #include "being.h" -class Network; - class NPC : public Being { public: - NPC(Uint32 id, Uint16 job, Map *map, Network *network); + NPC(Uint32 id, Uint16 job, Map *map); virtual Type getType() const; @@ -41,9 +39,6 @@ class NPC : public Being void buy(); void sell(); - - protected: - Network *mNetwork; }; extern NPC *current_npc; -- cgit v1.2.3-70-g09d2 From e8f94fe7ca5e7e7838eaa84f1792b4b42b4bada3 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Fri, 29 Sep 2006 23:59:08 +0000 Subject: Merged trunk changes from revision 2618 to 2716 into the 0.1.0 branch. --- ChangeLog | 339 ++++++++++++++++++++++++++++++--------- NEWS | 10 +- README | 3 +- data/graphics/images/Makefile.am | 9 +- data/help/changes.txt | 31 ++++ data/help/commands.txt | 1 + data/help/header.txt | 2 +- debian/changelog | 8 + debian/tmw-music.install | 2 + src/Makefile.am | 3 + src/animatedsprite.cpp | 87 +++++++--- src/animatedsprite.h | 16 +- src/animation.cpp | 33 +++- src/animation.h | 16 ++ src/being.cpp | 25 +-- src/beingmanager.cpp | 29 +++- src/beingmanager.h | 19 ++- src/engine.cpp | 4 +- src/floor_item.cpp | 4 +- src/game.cpp | 77 ++++++--- src/game.h | 17 +- src/gui/buy.cpp | 47 +++--- src/gui/buy.h | 12 +- src/gui/char_select.cpp | 22 +++ src/gui/char_select.h | 2 + src/gui/equipmentwindow.cpp | 4 +- src/gui/gui.cpp | 13 ++ src/gui/inventorywindow.cpp | 58 ++++--- src/gui/inventorywindow.h | 20 ++- src/gui/itemcontainer.cpp | 35 +++- src/gui/itemcontainer.h | 35 +++- src/gui/listbox.cpp | 57 ++++++- src/gui/listbox.h | 41 ++++- src/gui/minimap.cpp | 4 +- src/gui/playerbox.cpp | 2 +- src/gui/popupmenu.cpp | 2 +- src/gui/selectionlistener.h | 78 +++++++++ src/gui/sell.cpp | 40 +++-- src/gui/sell.h | 13 +- src/gui/setup.cpp | 4 +- src/gui/setup_video.cpp | 52 +++++- src/gui/setup_video.h | 4 + src/gui/trade.cpp | 63 ++++---- src/gui/trade.h | 10 +- src/gui/updatewindow.cpp | 18 ++- src/gui/updatewindow.h | 5 + src/gui/window.cpp | 12 +- src/item.h | 2 +- src/localplayer.h | 7 +- src/main.cpp | 108 +++++++------ src/map.cpp | 24 ++- src/net/inventoryhandler.cpp | 11 +- src/resources/image.cpp | 21 ++- src/resources/image.h | 7 + src/resources/iteminfo.cpp | 31 ++-- src/resources/iteminfo.h | 34 ++-- src/resources/itemmanager.cpp | 9 +- src/resources/itemmanager.h | 8 +- src/tmw.rc | 8 +- tools/Reorganize.java | 128 ++++++++++----- 60 files changed, 1336 insertions(+), 450 deletions(-) create mode 100644 src/gui/selectionlistener.h (limited to 'src/gui/buy.h') diff --git a/ChangeLog b/ChangeLog index aa54e32e..33fab8df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,10 +1,148 @@ -2006-08-30 Yohann Ferreira +2006-09-28 Björn Steinbrink + + * src/map.cpp: Fix random crashes when map tiles are missing. + +2006-09-28 Bjørn Lindeijer + + * data/graphics/maps/new_2-1.tmx.gz: Matt Howe fixed up cave map. + +2006-09-26 Eugenio Favalli + + * data/graphics/maps/new_6-1.tmx.gz: Alderan fixed a map issue. + +2006-09-25 Bjørn Lindeijer + + * data/graphics/sprites/hairstyle*.png, + data/graphics/sprites/hairstyle*.xml, tools/Reorganize.java: Removed + unused frames from the hairsets. + * src/resources/image.h: Defined NO_SDL_GLEXT to prevent a + redefinition when gl.h also tries to define OpenGL extensions (patch + accepted from Rogier Polak). + +2006-09-23 Bjørn Lindeijer + + * data/maps/new_5-1.tmx.gz: Accepted new version by Matt Howe, fixing + several mapping issues. + +2006-09-21 Eugenio Favalli + + * data/graphics/tiles/Makefile.am: Added missing tileset. + * src/gui/updatewindow.cpp, src/gui/updatewindow.h: Made canceling the + update process non-blocking (Patch by VictorSan). + +2006-09-21 Philipp Sehmisch + + * src/animation.cpp, src/animation.h, src/animatedsprite.cpp, + src/animatedsprite.h: Removed some obsolete code and implemented + the posibility to define an token in the s + that allows to define an animation that doesn't loop and returns + to the STAND animation when finished. + * data/graphics/sprites/hairstyle*.xml, + data/graphics/sprites/item0*.xml, + data/graphics/sprites/monster*.xml, + data/graphics/sprites/weapons.xml: Used the token for all + attack animations fixing the problem with looping monster attack + animations. + +2006-09-20 Philipp Sehmisch + + * data/graphics/items/generic-whitefur.png, + data/graphics/items/generic-cavesnakelamp.png, + data/graphics/items/generic-hardspike.png, + data/graphics/items/generic-pinkantennae.png, + data/graphics/items/Makefile.am, data/items.xml: Added drops for new + monsters. + * src/gui/setup.cpp, src/gui/setup_video.cpp, + src/gui/setup_video.h: Added a slider for controlling the overlay + detail to the video setup dialog based on a patch by VictorSan. + * data/maps/new_14-1.tmx.gz, data/maps/new_16-1.tmx.gz: Added cloud + effect and minimap. + * data/images/Makefile.am: Updated makefile. + +2006-09-19 Bjørn Lindeijer + + * data/graphics/sprites/Makefile.am: Added missing monster19 sprite. + +2006-09-17 Eugenio Favalli + + * data/maps/Makefile.am: Added missing maps. + * data/maps/new_10-1.tmx.gz: Disabled layer compression. + +2006-09-18 Philipp Sehmisch + + * data/maps/new_9-1.tmx.gz: Fixed some mapping bugs (new walkmap + required). + +2006-09-17 Eugenio Favalli + + * data/maps/new_10-1.tmx.gz: Fixed transparent snow issue (Fix by + Pajarico). + +2006-09-17 Björn Steinbrink + + * src/game.cpp: Stop using the sticky window attribute which is + unneeded for the current implementation, instead adjust the set of + affected windows by the 'hide' shortcut. + +2006-09-17 Philipp Sehmisch + + * data/maps/new_14-1.tmx.gz, data/maps/new_15-1.tmx.gz, + data/maps/new_16-1.tmx.gz: fixed some mapping errors. + +2006-09-16 Philipp Sehmisch + + * src/animatedsprite.cpp, src/animatedsprite.h: Fixed the crash when + attacking without a weapon, some additional stability improvements and + more descriptive variable names in the parsing algorithmn. + +2006-09-16 Eugenio Favalli + + * data/help/changes.txt, data/help/header.txt, NEWS, README, + src/tmw.rc: Updated release infos. + +2006-09-14 Philipp Sehmisch + + * src/animation.h, src/animatedsprite.h, + data/graphics/sprites/weapon.xml: Some modifications at the animation + system. No more "undefined action foo" warnings in the tmw.log. Not + visible actions must now be declared explicitely. + * data/graphics/images/ambient/sandstorm.png, + data/graphics/images/ambient/clouds.png: Improved quality of the overlay + graphics. + +2006-09-14 Björn Steinbrink + + * src/gui/char_select.cpp: Remove debug output. + * src/gui/char_select.cpp, src/main.cpp: Fix the character name + matching loop and add support for saving the last used character + (based on a patch by Andrew Harrison). + * src/gui/char_select.cpp, src/gui/char_select.h, src/main.cpp: Clean + up the player selection stuff, it's a bit nicer now. + * src/main.cpp: Fix up the player selection command line option. + +2006-09-13 Yohann Ferreira * src/Makefile.am, src/gui/widgets, src/gui/widgets/dropdown.h, src/gui/widgets/dropdown.cpp, src/gui/serverdialog.h, src/gui/serverdialog.cpp: Added a reusable skinned dropdown widget in the new widgets folder. Other widgets will be be moved there later. +2006-09-12 Bjørn Lindeijer + + * src/game.cpp, src/game.h: Simplified fps limiting a bit and added + some comments. Now based on ConfigListener so that the fpslimit option + doesn't need to be queried the whole time. + * NEWS: Updated with some items. + +2006-09-11 Eugenio Favalli + + * src/game.cpp: Fixed more fps issues. + +2006-09-09 Bjørn Lindeijer + + * src/gui/gui.cpp: Removed easy targeting functionality since it + interferes with walking around too much. Targeting can still be rather + conveniently done with 'a' or the middle mouse button. 2006-09-09 Guillaume Melquiond @@ -13,6 +151,72 @@ * src/localplayer.h, src/being.cpp, src/net/beinghandler.cpp, src/being.h: Fitted being trajectories to synchronization messages. +2006-09-07 Björn Steinbrink + + * src/resources/image.cpp: Fixed a typo. + * src/resources/image.cpp: Worked around a memory leak when using + OpenGL. + +2006-09-06 Philipp Sehmisch + + * data/graphics/sprites/item010.png, data/graphics/sprites/item010.xml, + data/graphics/sprites/Makefile.am: Added santa hat sprites and updated + makefile. + +2006-09-06 Eugenio Favalli + + * src/game.cpp, src/gui/setup_video.cpp, src/main.cpp: Fixed fps + limiter issues and increased default limit to 60. + * src/game.cpp: Fixed fps limiter when disabled. + +2006-09-05 Philipp Sehmisch + * data/graphics/tiles/Woodland_ground.png, + data/graphics/tiles/Woodland_x2.png, + data/graphics/tiles/Woodland_x3.png: Some minor improvements and + additions at my tilesets. + * data/graphics/sprites/monster0.xml, + data/graphics/sprites/monster1.xml, + data/graphics/sprites/monster2.xml, + data/graphics/sprites/monster3.xml, + data/graphics/sprites/monster4.xml, + data/graphics/sprites/monster5.xml, + data/graphics/sprites/monster6.xml, + data/graphics/sprites/monster8.xml, + data/graphics/sprites/monster9.xml, + data/graphics/sprites/monster11.xml, + data/graphics/sprites/monster13.xml, + data/graphics/sprites/monster0.xml: Adjusted the animation speed of + several monsters. + +2006-09-03 Bjørn Lindeijer + + * src/floor_item.cpp, src/gui/equipmentwindow.cpp, src/gui/sell.cpp, + src/gui/trade.cpp, src/gui/inventorywindow.h, + src/gui/selectionlistener.h, src/gui/itemcontainer.h, + src/gui/inventorywindow.cpp, src/gui/buy.cpp, + src/gui/itemcontainer.cpp, src/gui/popupmenu.cpp, src/item.h, + src/net/inventoryhandler.cpp, src/Makefile.am, + src/resources/itemmanager.h, src/resources/iteminfo.cpp, + src/resources/iteminfo.h, src/resources/itemmanager.cpp: Introduced + SelectionListener to fix updating problem in inventory window (should + also be used to fix similar problem in trade, buy and sell dialogs). + Made the ItemInfo be passed around as a reference instead of a pointer, + since it is never NULL. + * src/gui/trade.cpp, src/gui/trade.h: Fixed updating of labels in + trade window. + * src/gui/sell.cpp, src/gui/listbox.h, src/gui/inventorywindow.h, + src/gui/buy.h, src/gui/buy.cpp, src/gui/sell.h, src/gui/listbox.cpp: + Fixed updating of labels in buy and sell dialogs. Also made our + listbox respond to mouse dragging to change the selection. + +2006-09-02 Bernard Lidicky + + * src/game.cpp, src/beingmanager.h, src/gui/gui.cpp, + src/beingmanager.cpp, src/localplayer.h, README, + data/help/commands.txt, NEWS: Added targeting nearest monster with + either keyboard or mouse. Also made clicking beings in general a bit + easier (patch applied by Bjørn Lindeijer). + 2006-09-02 Bjørn Lindeijer * src/gui/serverdialog.cpp, src/main.cpp: Fixed crash when using short @@ -32,10 +236,22 @@ 2006-09-01 Eugenio Favalli + * data/graphics/sprites/monster19.png, + data/graphics/sprites/monster19.xml, data/graphics/tiles/arena.png, + data/graphics/tiles/cave.png, data/maps/new_17-1.tmx.gz, + data/maps/new_6-1.tmx.gz: Added new big cave map, lamp-snake monster, + improved arena map. * src/gui/serverdialog.cpp, src/gui/serverdialog.h, src/net/network.h: Fixed some header issues. * The Mana World.dev, tmw.cbp: Updated project files. +2006-08-30 Philipp Sehmisch + + * data/graphics/sprites/item007.png, + data/graphics/sprites/item007.xml, data/graphics/sprites/item009.png, + data/graphics/sprites/item009.xml: + Added sprites for miners helm and standard headband. + 2006-08-30 Yohann Ferreira * src/main.cpp, src/main.h, src/Makefile.am, src/gui/connection.h, @@ -44,17 +260,29 @@ with an unskinned dropdown. Upgraded also the connection window a bit to handle Cancelling more gracefully. -2006-08-27 Guillaume Melquiond +2006-08-29 Bjørn Lindeijer - * src/engine.cpp, src/gui/gui.cpp: Fixed merge issues: printfs and - inconsistency between view and camera variables. Fixed lazy scrolling: - there is no "freaking out" when the correct function is used. + * src/map.cpp, src/beingmanager.h, src/gui/minimap.cpp, + src/engine.cpp, src/beingmanager.cpp: It's better to use a reference + when you don't need a pointer. + * NEWS: Updated with addition of config file option. -2006-08-28 Bjørn Lindeijer +2006-08-29 Andrew Harrison - * src/gui/gui.cpp: Fixed crash when map is not loaded yet. - * src/net/beinghandler.cpp, src/net/protocol.h: Added support for - entering monsters. + * src/main.cpp: Added command line option to specify which + configuration file to use (patch applied by Bjørn Lindeijer). + +2006-08-29 Matthias Hartmann + + * data/graphics/sprites/item006.png, + data/graphics/sprites/item006.xml, data/graphics/sprites/item008.xml: + Fixed fancy hat + silk headband positions. + +2006-08-29 Philipp Sehmisch + + * data/graphics/sprites/item008.png, + data/graphics/sprites/item008.xml, data/graphics/sprites/Makefile.am: + Added fancy hat sprite. 2006-08-28 Philipp Sehmisch @@ -70,6 +298,12 @@ data/graphics/sprites/item006.xml, data/graphics/sprites/Makefile.am: Added headband and fixed svn properties. +2006-08-28 Bjørn Lindeijer + + * src/gui/gui.cpp: Fixed crash when map is not loaded yet. + * src/net/beinghandler.cpp, src/net/protocol.h: Added support for + entering monsters. + 2006-08-27 Guillaume Melquiond * src/localplayer.cpp, src/net/protocol.h: Send move message @@ -89,11 +323,14 @@ src/monster.cpp, src/player.h: Cleaned the logic members. * src/engine.cpp, src/localplayer.cpp, src/gui/gui.cpp, src/being.cpp, src/being.h: Implemented pixel-grained movements. + * src/engine.cpp, src/gui/gui.cpp: Fixed merge issues: printfs and + inconsistency between view and camera variables. Fixed lazy scrolling: + there is no "freaking out" when the correct function is used. 2006-08-27 Bjørn Lindeijer - * src/net/inventoryhandler.cpp: Applied patch by AHarrison that adds - item pickup messages to the chat window. + * src/net/inventoryhandler.cpp: Applied patch by Andrew Harrison that + adds item pickup messages to the chat window. * NEWS: Updated with some recently added and fixed issues. Doesn't mention any of the recent content updates yet. * src/localplayer.cpp, src/gui/sell.cpp, src/gui/trade.cpp, @@ -173,7 +410,7 @@ * data/help/commands.txt, README, src/game.cpp, src/gui/chat.cpp, src/gui/window.cpp, src/gui/window.h: Added support for sticky windows - as discussed with doener. Patch by AHarrison. + as discussed with doener. Patch by Andrew Harrison. * data/items.xml: Added jeans shorts. 2006-08-24 Philipp Sehmisch @@ -235,11 +472,11 @@ 2006-08-20 Yohann Ferreira - * data/graphics/sprites/Makefile.am : Following the splitting from + * data/graphics/sprites/Makefile.am: Following the splitting from Philipp, moved out the items.png file from the Makefile.am. - * debian/control, debian/tmw-data.install : Updated debian package + * debian/control, debian/tmw-data.install: Updated debian package creation process. - * src/Makefile.am : Added iteminfo.cpp to avoid an undefined reference + * src/Makefile.am: Added iteminfo.cpp to avoid an undefined reference with gcc 4.1.2. Happy to be back :) 2006-08-20 Bjørn Lindeijer @@ -288,13 +525,13 @@ * src/itemmanager.cpp, data/items.xml: Replaced indices on the item spriteset with filenames. added names and descriptions for all missing items. Changed names and dascriptions of some items. - * src/engine.cpp: removed global item spriteset. + * src/engine.cpp: Removed global item spriteset. * src/floor_item.cpp, src/floor_item.h, src/iteminfo.cpp, src/iteminfo.h, src/equipmentwindow.cpp, src/equipmentwindow.h, - src/itemcontainer.cpp, src/itemcontainer.h: the iteminfo class now + src/itemcontainer.cpp, src/itemcontainer.h: The iteminfo class now provides a pointer to the item icon image instead of providing the index on the item spriteset. - * data/graphics/tiles/trans_desert-woodland.png: added transmission + * data/graphics/tiles/trans_desert-woodland.png: Added transmission tileset between desert and woodland. 2006-08-15 Bjørn Lindeijer @@ -527,8 +764,8 @@ char server selection dialog, and added character visualization in character selection dialog. * data/graphics/sprites/Makefile.am, data/graphics/tiles/Makefile.am, - data/maps/Makefile.am, data/maps/new_13-1.tmx.gz: Added map with inside - of snow village buildings and fixed makefiles. + data/maps/Makefile.am, data/maps/new_13-1.tmx.gz: Added map with + inside of snow village buildings and fixed makefiles. * src/being.cpp, src/being.h, src/player.cpp: Fixed direction and action issues when changing appeareance, frames are still out of sync. * data/maps/Makefile.am, data/maps/new_14-1.tmx.gz, @@ -704,8 +941,8 @@ 2006-07-12 Frode Lindeijer - * /tmw/trunk/data/graphics/sprites/item001.png: Completed the cotton - shirt equipment graphic. + * data/graphics/sprites/item001.png: Completed the cotton shirt + equipment graphic. 2006-07-06 Philipp Sehmisch @@ -755,68 +992,20 @@ * src/being.h, src/being.cpp, src/npc.cpp, src/npc.h, src/monster.cpp, src/monster.h: Moved all drawing code from the Being based classes into Being. - * data/graphics/sprites/monster0.png, - data/graphics/sprites/monster1.png, - data/graphics/sprites/monster2.png, - data/graphics/sprites/monster3.png, - data/graphics/sprites/monster4.png, - data/graphics/sprites/monster5.png, - data/graphics/sprites/monster6.png, - data/graphics/sprites/monster7.png, - data/graphics/sprites/monster8.png, - data/graphics/sprites/monster9.png, - data/graphics/sprites/monster10.png, - data/graphics/sprites/monster11.png, - data/graphics/sprites/monster12.png, - data/graphics/sprites/monster13.png, - data/graphics/sprites/monster14.png, - data/graphics/sprites/monster15.png, - data/graphics/sprites/monster16.png, - data/graphics/sprites/monster17.png: Resized and reorganized the + * data/graphics/sprites/monster*.png: Resized and reorganized the monster spritesets to fit the new animation system (thanks, Bjørn). - * data/graphics/sprites/monster0.xml, - data/graphics/sprites/monster1.xml, - data/graphics/sprites/monster2.xml, - data/graphics/sprites/monster3.xml, - data/graphics/sprites/monster4.xml, - data/graphics/sprites/monster5.xml, - data/graphics/sprites/monster6.xml, - data/graphics/sprites/monster7.xml, - data/graphics/sprites/monster8.xml, - data/graphics/sprites/monster9.xml, - data/graphics/sprites/monster10.xml, - data/graphics/sprites/monster11.xml, - data/graphics/sprites/monster12.xml, - data/graphics/sprites/monster13.xml, - data/graphics/sprites/monster14.xml, - data/graphics/sprites/monster15.xml, - data/graphics/sprites/monster16.xml, - data/graphics/sprites/monster17.xml: Added animation files for all + * data/graphics/sprites/monster*.xml: Added animation files for all monsters. * src/animation.cpp: The offset values of the Frames of animated sprites are now modified so every frame is drawn centered. - * data/graphics/sprites/hairstyle0.xml, - data/graphics/sprites/hairstyle1.xml, - data/graphics/sprites/hairstyle2.xml, - data/graphics/sprites/hairstyle3.xml, - data/graphics/sprites/hairstyle4.xml, - data/graphics/sprites/hairstyle5.xml, - data/graphics/sprites/hairstyle6.xml, - data/graphics/sprites/hairstyle7.xml: Retuned the offsets of the hair - sprites. + * data/graphics/sprites/hairstyle*.xml: Retuned the offsets of the + hair sprites. * src/animation.cpp: Small stability fix. * src/being.cpp, src/being.h: weapon animation now uses the new animation system. * data/graphics/sprites/player_male_base.xml data/graphics/sprites/player_female_base.xml - data/graphics/sprites/hairstyle0.xml, - data/graphics/sprites/hairstyle1.xml, - data/graphics/sprites/hairstyle2.xml, - data/graphics/sprites/hairstyle3.xml, - data/graphics/sprites/hairstyle4.xml, - data/graphics/sprites/hairstyle5.xml, - data/graphics/sprites/hairstyle6.xml, - data/graphics/sprites/hairstyle7.xml: Tuned walk speed and added bow + data/graphics/sprites/hairstyle*.xml: Tuned walk speed and added bow animations. 2006-07-03 Eugenio Favalli diff --git a/NEWS b/NEWS index cf837a25..2b77dca3 100644 --- a/NEWS +++ b/NEWS @@ -1,12 +1,18 @@ -0.0.21 (.. September 2006) +0.0.21 (17 September 2006) - Added item pickup messages to the chat dialog - Added XP bar to ministatus in the top left - Added configurable smooth and lazy scrolling - Added option to turn off the joystick -- Added --playername command line option for automatic character picking +- Added --playername option for automatic character picking +- Added --configfile option for specifying which configuration file to use +- Added shortcut and middle mouse button for targetting nearest monster +- Added support for map effect overlays +- Fixed FPS limiter - Fixed updating system on Windows - Fixed player animations going out of sync on changing equipment or hairstyle - Fixed SDL_image configure check on some systems by first checking for libpng +- Fixed big memory leak when using OpenGL +- Updated to work with Guichan 0.5.0 (older versions no longer supported) 0.0.20 (24 July 2006) - Added new hairstyle, and some fixes to the old ones diff --git a/README b/README index 5fad4312..0313fac3 100644 --- a/README +++ b/README @@ -1,7 +1,7 @@ THE MANA WORLD ============== - Version: 0.0.20 Date: 23/07/2006 + Version: 0.0.21 Date: 17/09/2006 Development team: @@ -53,6 +53,7 @@ Use arrow keys to move around. Other keys: - Alt + S sit down / stand up - Alt + F toggle debug pathfinding feature - Alt + P take screenshot +- A target nearest monster - H hide all non-sticky windows - G or Z pick up item - Enter focus chat window / send message diff --git a/data/graphics/images/Makefile.am b/data/graphics/images/Makefile.am index e0707698..fb54cb95 100644 --- a/data/graphics/images/Makefile.am +++ b/data/graphics/images/Makefile.am @@ -7,7 +7,12 @@ images_DATA = \ minimap_new_1-1.png \ minimap_new_2-1.png \ minimap_new_3-1.png \ - minimap_new_5-1.png + minimap_new_5-1.png \ + minimap_new_7-1.png \ + minimap_new_9-1.png \ + minimap_new_14-1.png \ + minimap_new_15-1.png \ + minimap_new_16-1.png EXTRA_DIST = \ - $(images_DATA) + $(images_DATA) \ No newline at end of file diff --git a/data/help/changes.txt b/data/help/changes.txt index 2d0f9d86..f8a3eb67 100644 --- a/data/help/changes.txt +++ b/data/help/changes.txt @@ -3,6 +3,37 @@ ##3 === RECENT CHANGES === + 0.0.21 (17 September 2006) + - Added item pickup messages to the chat dialog + - Added XP bar to ministatus in the top left + - Added configurable smooth and lazy scrolling + - Added option to turn off the joystick + - Added --playername option for automatic character picking + - Added --configfile option for specifying which configuration file to use + - Added shortcut and middle mouse button for targetting nearest monster + - Added support for map effect overlays + - Fixed FPS limiter + - Fixed updating system on Windows + - Fixed player animations going out of sync on changing equipment or hairstyle + - Fixed SDL_image configure check on some systems by first checking for libpng + - Fixed big memory leak when using OpenGL + - Updated to work with Guichan 0.5.0 (older versions no longer supported) + + 0.0.20 (24 July 2006) + - Added new hairstyle, and some fixes to the old ones + - Added slider to set FPS limit + - Added visible equipments + - Added new maps and monsters + - Added female characters + - Implemented a new animation system + - Updated the updating system + - Reduced size of textures to stay within the limits of some OpenGL drivers + - Fixed connection not being shut down completely in case of an error + - Fixed min size of a window when resizing + - Fixed some maps issues + - Some fixes to monsters and player graphics + - Minor bug fixes and lots of code cleanups + 0.0.19 (6 March 2006) - Added --username, --password and --defaults command line options diff --git a/data/help/commands.txt b/data/help/commands.txt index 37c77df2..ab93b54e 100644 --- a/data/help/commands.txt +++ b/data/help/commands.txt @@ -23,6 +23,7 @@ ##2Alt + S##P sit down / stand up ##2Alt + F##P toggle debug pathfinding feature ##2Alt + P##P take screenshot + ##2A##P target nearest monster ##2H##P hide all non-sticky windows ##2G or Z##P pick up item ##2Enter##P focus chat window / send message diff --git a/data/help/header.txt b/data/help/header.txt index d9188a3b..30c1dc93 100644 --- a/data/help/header.txt +++ b/data/help/header.txt @@ -2,7 +2,7 @@ ##1 T H E M A N A W O R L D ##1 ========================================== - ##2Version:##6 0.0.20 ##2Date:##6 23 July 2006 + ##2Version:##6 0.0.21 ##2Date:##6 17 September 2006 ##2 Website: http://themanaworld.org diff --git a/debian/changelog b/debian/changelog index eb420daf..5e71e51e 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +tmw (0.0.21-1) unstable; urgency=low + + * New upstream release: + * Now linked against libguichan-0.5.0. + * Readded the correct music package. + + -- FERREIRA Yohann Wed, 27 Sep 2006 21:40:33 +0200 + tmw (0.0.20-1) unstable; urgency=low * Make use of a own desktop file for the Debian Package. Close the missing icon bug. diff --git a/debian/tmw-music.install b/debian/tmw-music.install index b3494726..b4a17199 100644 --- a/debian/tmw-music.install +++ b/debian/tmw-music.install @@ -1 +1,3 @@ data/music/*.ogg usr/share/games/tmw/data/music +data/music/*.mp3 usr/share/games/tmw/data/music + diff --git a/src/Makefile.am b/src/Makefile.am index 01f8a3b2..b621c63e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,6 +2,8 @@ AUTOMAKE_OPTIONS = subdir-objects bin_PROGRAMS = tmw tmw_SOURCES = graphic/imagerect.h \ + gui/widgets/dropdown.cpp \ + gui/widgets/dropdown.h \ gui/browserbox.cpp \ gui/browserbox.h \ gui/buddywindow.cpp \ @@ -77,6 +79,7 @@ tmw_SOURCES = graphic/imagerect.h \ gui/register.h \ gui/scrollarea.cpp \ gui/scrollarea.h \ + gui/selectionlistener.h \ gui/sell.cpp \ gui/sell.h \ gui/serverdialog.cpp \ diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index f984d13f..3815f04a 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -18,7 +18,7 @@ * 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: animation.cpp 2430 2006-07-24 00:13:24Z b_lindeijer $ + * $Id$ */ #include "animatedsprite.h" @@ -90,14 +90,9 @@ AnimatedSprite::AnimatedSprite(const std::string& animationFile, int variant): // get action else if (xmlStrEqual(node->name, BAD_CAST "action")) { - std::string name = getProperty(node, "name", ""); + std::string actionName = getProperty(node, "name", ""); std::string imageset = getProperty(node, "imageset", ""); - if (name.empty()) - { - logger->log("Warning: unnamed action in %s", - animationFile.c_str()); - } if (mSpritesets.find(imageset) == mSpritesets.end()) { logger->log("Warning: imageset \"%s\" not defined in %s", imageset.c_str(), @@ -107,10 +102,25 @@ AnimatedSprite::AnimatedSprite(const std::string& animationFile, int variant): continue; } - Action *action = new Action(); + SpriteAction actionType = makeSpriteAction(actionName); + if (actionType == ACTION_INVALID) + { + logger->log("Warning: Unknown action \"%s\" defined in %s", + actionName.c_str(), + animationFile.c_str()); + continue; + } + Action *action = new Action(); action->setSpriteset(mSpritesets[imageset]); - mActions[makeSpriteAction(name)] = action; + mActions[actionType] = action; + + // When first action set it as default direction + if (mActions.empty()) + { + mActions[ACTION_DEFAULT] = action; + } + // get animations for (xmlNodePtr animationNode = node->xmlChildrenNode; @@ -121,9 +131,20 @@ AnimatedSprite::AnimatedSprite(const std::string& animationFile, int variant): if (!xmlStrEqual(animationNode->name, BAD_CAST "animation")) continue; - std::string dir = getProperty(animationNode, "direction", ""); + std::string directionName = getProperty(animationNode, "direction", ""); + + SpriteDirection directionType = makeSpriteDirection(directionName); + if (directionType == DIRECTION_INVALID) + { + logger->log("Warning: Unknown direction \"%s\" defined for action %s in %s", + directionName.c_str(), + actionName.c_str(), + animationFile.c_str()); + continue; + } + Animation *animation = new Animation(); - action->setAnimation(makeSpriteDirection(dir), animation); + action->setAnimation(directionType, animation); // Get animation phases for (xmlNodePtr phaseNode = animationNode->xmlChildrenNode; @@ -156,12 +177,17 @@ AnimatedSprite::AnimatedSprite(const std::string& animationFile, int variant): start++; } } + else if (xmlStrEqual(phaseNode->name, BAD_CAST "end")) + { + animation->addTerminator(); + }; } // for phaseNode } // for animationNode } // if "" else if "" } // for node // Complete missing actions + substituteAction(ACTION_STAND, ACTION_DEFAULT); substituteAction(ACTION_WALK, ACTION_STAND); substituteAction(ACTION_WALK, ACTION_RUN); substituteAction(ACTION_ATTACK, ACTION_STAND); @@ -247,7 +273,7 @@ AnimatedSprite::reset() } void -AnimatedSprite::play(SpriteAction action, int time) +AnimatedSprite::play(SpriteAction action) { ActionIterator i = mActions.find(action); @@ -262,31 +288,31 @@ AnimatedSprite::play(SpriteAction action, int time) if (mAction != i->second) { mAction = i->second; - mLastTime = 0; - } - - if (!mAction || !time) - mSpeed = 1.0f; - else { - int animationLength = mAction->getAnimation(mDirection)->getLength(); - mSpeed = (float) animationLength / time; + //mAction->reset(); } } void AnimatedSprite::update(int time) { + bool notFinished = true; // Avoid freaking out at first frame or when tick_time overflows if (time < mLastTime || mLastTime == 0) mLastTime = time; - // If not enough time have passed yet, do nothing + // If not enough time has passed yet, do nothing if (time > mLastTime && mAction) { Animation *animation = mAction->getAnimation(mDirection); - animation->update((unsigned int)((time - mLastTime) * mSpeed)); + if (animation != NULL) { + notFinished = animation->update((unsigned int)(time - mLastTime));} mLastTime = time; } + + if (!notFinished) + { + play(ACTION_STAND); + } } bool @@ -296,6 +322,8 @@ AnimatedSprite::draw(Graphics* graphics, Sint32 posX, Sint32 posY) const return false; Animation *animation = mAction->getAnimation(mDirection); + if (animation == NULL) return false; + int phase = animation->getCurrentPhase(); if (phase < 0) return false; @@ -322,6 +350,9 @@ AnimatedSprite::getHeight() const SpriteAction AnimatedSprite::makeSpriteAction(const std::string& action) { + if (action == "" || action == "default") { + return ACTION_DEFAULT; + } if (action == "stand") { return ACTION_STAND; } @@ -365,14 +396,17 @@ AnimatedSprite::makeSpriteAction(const std::string& action) return ACTION_DEAD; } else { - return ACTION_DEFAULT; + return ACTION_INVALID; } } SpriteDirection AnimatedSprite::makeSpriteDirection(const std::string& direction) { - if (direction == "up") { + if (direction == "" || direction == "default") { + return DIRECTION_DEFAULT; + } + else if (direction == "up") { return DIRECTION_UP; } else if (direction == "left") { @@ -381,7 +415,10 @@ AnimatedSprite::makeSpriteDirection(const std::string& direction) else if (direction == "right") { return DIRECTION_RIGHT; } - else { + else if (direction == "down") { return DIRECTION_DOWN; } + else { + return DIRECTION_INVALID; + }; } diff --git a/src/animatedsprite.h b/src/animatedsprite.h index b73bdb5c..bda612ab 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.h @@ -18,7 +18,7 @@ * 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: animation.h 2430 2006-07-24 00:13:24Z b_lindeijer $ + * $Id$ */ #ifndef _TMW_ANIMATEDSPRITE_H @@ -50,15 +50,18 @@ enum SpriteAction ACTION_SIT, ACTION_SLEEP, ACTION_HURT, - ACTION_DEAD + ACTION_DEAD, + ACTION_INVALID }; enum SpriteDirection { - DIRECTION_DOWN = 0, + DIRECTION_DEFAULT = 0, + DIRECTION_DOWN, DIRECTION_UP, DIRECTION_LEFT, - DIRECTION_RIGHT + DIRECTION_RIGHT, + DIRECTION_INVALID }; /** @@ -85,11 +88,10 @@ class AnimatedSprite reset(); /** - * Plays an action using the current direction that will have a - * duration of the specified time, 0 means default. + * Plays an action using the current direction */ void - play(SpriteAction action, int time = 0); + play(SpriteAction action); /** * Inform the animation of the passed time so that it can output the diff --git a/src/animation.cpp b/src/animation.cpp index c1b27ebd..98a4abb8 100644 --- a/src/animation.cpp +++ b/src/animation.cpp @@ -39,45 +39,68 @@ Animation::reset() iCurrentPhase = mAnimationPhases.begin(); } -void + +bool Animation::update(unsigned int time) { mTime += time; if (mAnimationPhases.empty()) - return; + return true; + if (isTerminator(*iCurrentPhase)) + return false; unsigned int delay = iCurrentPhase->delay; - if (!delay) - return; while (mTime > delay) { + if (!delay) + return true; mTime -= delay; iCurrentPhase++; if (iCurrentPhase == mAnimationPhases.end()) { iCurrentPhase = mAnimationPhases.begin(); } + if (isTerminator(*iCurrentPhase)) + return false; + delay = iCurrentPhase->delay; } + return true; } + int Animation::getCurrentPhase() const { return mAnimationPhases.empty() ? -1 : iCurrentPhase->image; } + void Animation::addPhase(int image, unsigned int delay, int offsetX, int offsetY) { //add new phase to animation list - AnimationPhase newPhase = { image, delay, offsetX, offsetY }; + AnimationPhase newPhase = { image, delay, offsetX, offsetY}; mAnimationPhases.push_back(newPhase); //reset animation circle iCurrentPhase = mAnimationPhases.begin(); } +void +Animation::addTerminator() +{ + AnimationPhase terminator = { -1, 0, 0, 0}; + mAnimationPhases.push_back(terminator); + iCurrentPhase = mAnimationPhases.begin(); +} + +bool +Animation::isTerminator(AnimationPhase candidate) +{ + return (candidate.image < 0); +} + int Animation::getLength() { diff --git a/src/animation.h b/src/animation.h index 60dcd287..605d8cb1 100644 --- a/src/animation.h +++ b/src/animation.h @@ -61,10 +61,25 @@ class Animation void reset(); + /** + * Appends a new animation at the end of the sequence + */ void addPhase(int image, unsigned int delay, int offsetX, int offsetY); + /** + * Appends an animation terminator that states that the animation + * should not loop + */ void + addTerminator(); + + /** + * Updates animation phase. + * true indicates a still running animation while false indicates a + * finished animation + */ + bool update(unsigned int time); int @@ -89,6 +104,7 @@ class Animation getLength(); protected: + static bool isTerminator(AnimationPhase); std::list mAnimationPhases; std::list::iterator iCurrentPhase; unsigned int mTime; diff --git a/src/being.cpp b/src/being.cpp index 982b0ebf..4d542753 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -331,10 +331,24 @@ Being::setAction(Uint8 action) currentAction = ACTION_ATTACK; break; } + for (int i = 0; i < VECTOREND_SPRITE; i++) + { + if (mSprites[i]) + { + mSprites[i]->reset(); + } + } }; break; case MONSTER_ATTACK: currentAction = ACTION_ATTACK; + for (int i = 0; i < VECTOREND_SPRITE; i++) + { + if (mSprites[i]) + { + mSprites[i]->reset(); + } + } break; case DEAD: currentAction = ACTION_DEAD; @@ -346,16 +360,7 @@ Being::setAction(Uint8 action) for (int i = 0; i < VECTOREND_SPRITE; i++) { - if (!mSprites[i]) - continue; - - if (currentAction == ACTION_ATTACK || - currentAction == ACTION_ATTACK_STAB || - currentAction == ACTION_ATTACK_BOW) - { - mSprites[i]->play(currentAction, mAttackSpeed); - } - else + if (mSprites[i]) { mSprites[i]->play(currentAction); } diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index d2db055a..30b68ee2 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -113,9 +113,9 @@ Being* BeingManager::findBeing(Uint16 x, Uint16 y, Being::Type type) return (i == mBeings.end()) ? NULL : *i; } -Beings* BeingManager::getAll() +Beings& BeingManager::getAll() { - return &mBeings; + return mBeings; } void BeingManager::logic() @@ -153,3 +153,28 @@ void BeingManager::clear() mBeings.push_back(player_node); } } + +Being* BeingManager::findNearestLivingBeing(Uint16 x, Uint16 y, int maxdist, + Being::Type type) +{ + Being *closestBeing = NULL; + int dist = 0; + + for (BeingIterator i = mBeings.begin(); i != mBeings.end(); i++) + { + Being *being = (*i); + int d = abs(being->mX - x) + abs(being->mY - y); + + if ((being->getType() == type || type == Being::UNKNOWN) + && (d < dist || closestBeing == NULL) // it is closer + && being->mAction != Being::DEAD // no dead beings + && being->mAction != Being::MONSTER_DEAD + ) + { + dist = d; + closestBeing = being; + } + } + + return (maxdist >= dist) ? closestBeing : NULL; +} diff --git a/src/beingmanager.h b/src/beingmanager.h index c32884a0..15a347de 100644 --- a/src/beingmanager.h +++ b/src/beingmanager.h @@ -46,29 +46,38 @@ class BeingManager void setPlayer(LocalPlayer *player); /** - * Create a being and add it to the list of beings + * Create a being and add it to the list of beings. */ Being* createBeing(Uint16 id, Uint16 job); /** - * Remove a Being + * Remove a Being. */ void destroyBeing(Being *being); /** - * Return a specific id Being + * Return a specific id Being. */ Being* findBeing(Uint16 id); /** - * Return a being at specific coordinates + * Return a being at specific coordinates. */ Being* findBeing(Uint16 x, Uint16 y, Being::Type type = Being::UNKNOWN); + /** + * Return a being nearest to specific coordinates. + * + * \param maxdist maximal distance. If minimal distance is larger, + * no being is returned + */ + Being* findNearestLivingBeing(Uint16 x, Uint16 y, int maxdist, + Being::Type type = Being::UNKNOWN); + /** * Returns the whole list of beings */ - Beings* getAll(); + Beings& getAll(); /** * Logic. diff --git a/src/engine.cpp b/src/engine.cpp index 253a8288..231313c4 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -266,8 +266,8 @@ void Engine::draw(Graphics *graphics) } // Draw player nickname, speech, and emotion sprite as needed - Beings *beings = beingManager->getAll(); - for (BeingIterator i = beings->begin(); i != beings->end(); i++) + Beings &beings = beingManager->getAll(); + for (BeingIterator i = beings.begin(); i != beings.end(); i++) { (*i)->drawSpeech(graphics, -camera_x, -camera_y); (*i)->drawName(graphics, -camera_x, -camera_y); diff --git a/src/floor_item.cpp b/src/floor_item.cpp index edd5d4a7..9a179a21 100644 --- a/src/floor_item.cpp +++ b/src/floor_item.cpp @@ -42,7 +42,7 @@ FloorItem::FloorItem(unsigned int id, mMap(map) { // Retrieve item image from item info - mImage = itemDb->getItemInfo(itemId)->getImage(); + mImage = itemDb->getItemInfo(itemId).getImage(); // Add ourselves to the map mSpriteIterator = mMap->addSprite(this); @@ -50,6 +50,6 @@ FloorItem::FloorItem(unsigned int id, FloorItem::~FloorItem() { - // Remove and delete the representative sprite + // Remove ourselves from the map mMap->removeSprite(mSpriteIterator); } diff --git a/src/game.cpp b/src/game.cpp index f5ebe095..5e4c24c2 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -202,9 +202,9 @@ void createGuiWindows() minimap->getHeight() + 30);*/ // Set initial window visibility - chatWindow->setSticky(true); - miniStatusWindow->setSticky(true); - menuWindow->setSticky(true); +// chatWindow->setSticky(true); +// miniStatusWindow->setSticky(true); +// menuWindow->setSticky(true); chatWindow->setVisible(true); miniStatusWindow->setVisible(true); @@ -277,6 +277,10 @@ Game::Game(): SDL_AddTimer(10, nextTick, NULL); // Logic counter SDL_AddTimer(1000, nextSecond, NULL); // Seconds counter + // Initialize frame limiting + config.addListener("fpslimit", this); + optionChanged("fpslimit"); + // Initialize beings beingManager->setPlayer(player_node); @@ -339,12 +343,23 @@ bool saveScreenshot(SDL_Surface *screenshot) return ImageWriter::writePNG(screenshot, filename.str()); } +void Game::optionChanged(const std::string &name) +{ + int fpsLimit = (int) config.getValue("fpslimit", 0); + + // Calculate new minimum frame time + mMinFrameTime = fpsLimit ? 1000 / fpsLimit : 0; + + // Reset draw time to current time + mDrawTime = tick_time * 10; +} + void Game::logic() { + // mDrawTime has a higher granularity than gameTime in order to be able to + // work with minimum frame durations in milliseconds. int gameTime = tick_time; - int drawTime = tick_time * 10; - int delta = 0; - int fpsLimit = 0; + mDrawTime = tick_time * 10; while (!done) { @@ -356,23 +371,35 @@ void Game::logic() gameTime++; } + // This is done because at some point tick_time will wrap. gameTime = tick_time; - fpsLimit = (int)config.getValue("fpslimit", 50); - delta = fpsLimit ? 1000 / fpsLimit : 0; - - // Update the screen when application is active, delay otherwise - if (SDL_GetAppState() & SDL_APPACTIVE && - (abs(tick_time * 10 - drawTime) >= delta)) + // Update the screen when application is active, delay otherwise. + if (SDL_GetAppState() & SDL_APPACTIVE) { - frame++; - engine->draw(graphics); - graphics->updateScreen(); - drawTime += delta; + // Draw a frame if either frames are not limited or enough time has + // passed since the last frame. + if (!mMinFrameTime || + get_elapsed_time(mDrawTime / 10) > mMinFrameTime) + { + frame++; + engine->draw(graphics); + graphics->updateScreen(); + mDrawTime += mMinFrameTime; + + // Make sure to wrap mDrawTime, since tick_time will wrap. + if (mDrawTime > MAX_TIME * 10) + mDrawTime -= MAX_TIME * 10; + } + else + { + SDL_Delay(10); + } } else { SDL_Delay(10); + mDrawTime = tick_time * 10; } // Handle network stuff @@ -463,10 +490,7 @@ void Game::handleInput() // Attempt to hide all windows case SDLK_h: - chatWindow->setVisible(false); - miniStatusWindow->setVisible(false); statusWindow->setVisible(false); - menuWindow->setVisible(false); buyDialog->setVisible(false); sellDialog->setVisible(false); buySellDialog->setVisible(false); @@ -474,12 +498,9 @@ void Game::handleInput() npcTextDialog->setVisible(false); npcListDialog->setVisible(false); skillDialog->setVisible(false); - //newSkillWindow->setVisible(false); setupWindow->setVisible(false); equipmentWindow->setVisible(false); chargeDialog->setVisible(false); - tradeWindow->setVisible(false); - //buddyWindow->setVisible(false); helpWindow->setVisible(false); debugWindow->setVisible(false); break; @@ -679,6 +700,18 @@ void Game::handleInput() player_node->attack(target, newTarget); } + // Target the nearest monster if 'a' pressed + if (keys[SDLK_a]) + { + Being *target = + beingManager->findNearestLivingBeing(x, y, 20, Being::MONSTER); + + if (target) + { + player_node->setTarget(target); + } + } + if (joystick) { if (joystick->buttonPressed(1)) diff --git a/src/game.h b/src/game.h index 7330052a..19a6054a 100644 --- a/src/game.h +++ b/src/game.h @@ -27,6 +27,8 @@ #include #include +#include "configlistener.h" + #define SPEECH_TIME 80 #define SPEECH_MAX_TIME 100 @@ -36,7 +38,7 @@ extern std::string map_path; extern volatile int fps; extern volatile int tick_time; -class Game +class Game : public ConfigListener { public: Game(); @@ -46,7 +48,15 @@ class Game void handleInput(); - protected: + void optionChanged(const std::string &name); + + private: + /** Used to determine whether to draw the next frame. */ + int mDrawTime; + + /** The minimum frame time (used for frame limiting). */ + int mMinFrameTime; + typedef std::auto_ptr MessageHandlerPtr; MessageHandlerPtr mBeingHandler; MessageHandlerPtr mBuySellHandler; @@ -61,8 +71,7 @@ class Game }; /** - * Returns elapsed time. (Warning: very unsafe function, it supposes the delay - * is always < 10 seconds) + * Returns elapsed time. (Warning: supposes the delay is always < 100 seconds) */ int get_elapsed_time(int start_time); diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 165fa7dc..ae779503 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -91,6 +91,7 @@ BuyDialog::BuyDialog(): mSlider->setEventId("slider"); mItemList->addActionListener(this); + mItemList->addSelectionListener(this); mSlider->addActionListener(this); add(mScrollArea); @@ -140,7 +141,8 @@ void BuyDialog::addItem(short id, int price) { ITEM_SHOP item_shop; - item_shop.name = itemDb->getItemInfo(id)->getName() + " " + toString(price) + " GP"; + item_shop.name = itemDb->getItemInfo(id).getName() + " " + + toString(price) + " GP"; item_shop.price = price; item_shop.id = id; @@ -152,7 +154,8 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) { int selectedItem = mItemList->getSelected(); - if (eventId == "item") { + if (eventId == "item") + { // Reset amount of items and update labels mAmountItems = 0; mSlider->setValue(0); @@ -175,23 +178,27 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) mIncreaseButton->setEnabled(mMaxItems > 0); mSlider->setEnabled(mMaxItems > 0); } - else if (eventId == "quit") { + else if (eventId == "quit") + { setVisible(false); current_npc = 0; } // The following actions require a valid selection - if (selectedItem < 0 || selectedItem >= int(mShopItems->size())) { + if (selectedItem < 0 || selectedItem >= int(mShopItems->size())) + { return; } bool updateButtonsAndLabels = false; - if (eventId == "slider") { + if (eventId == "slider") + { mAmountItems = (int)(mSlider->getValue() * mMaxItems); updateButtonsAndLabels = true; } - else if (eventId == "+") { + else if (eventId == "+") + { if (mAmountItems < mMaxItems) { mAmountItems++; } else { @@ -201,7 +208,8 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) mSlider->setValue(double(mAmountItems)/double(mMaxItems)); updateButtonsAndLabels = true; } - else if (eventId == "-") { + else if (eventId == "-") + { if (mAmountItems > 0) { mAmountItems--; } else { @@ -211,7 +219,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) mSlider->setValue(double(mAmountItems)/double(mMaxItems)); updateButtonsAndLabels = true; } - // TODO Actually we'd have a bug elsewhere if this check for the number + // TODO: Actually we'd have a bug elsewhere if this check for the number // of items to be bought ever fails, Bertram removed the assertions, is // there a better way to ensure this fails in an _obivous_ way in C++? else if (eventId == "buy" && (mAmountItems > 0 && @@ -239,7 +247,8 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) } // If anything has changed, we have to update the buttons and labels - if (updateButtonsAndLabels) { + if (updateButtonsAndLabels) + { // Update buttons mIncreaseButton->setEnabled(mAmountItems < mMaxItems); mDecreaseButton->setEnabled(mAmountItems > 0); @@ -255,19 +264,21 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) } } -void BuyDialog::mouseClick(int x, int y, int button, int count) +void BuyDialog::selectionChanged(const SelectionEvent &event) { - Window::mouseClick(x, y, button, count); - int selectedItem = mItemList->getSelected(); + if (selectedItem > -1) { - int itemId = mShopItems->at(selectedItem).id; - ItemInfo *itemInfo = itemDb->getItemInfo(itemId); + const ItemInfo &info = + itemDb->getItemInfo(mShopItems->at(selectedItem).id); - mItemDescLabel->setCaption("Description: " + - itemInfo->getDescription()); - mItemEffectLabel->setCaption("Effect: " + - itemInfo->getEffect()); + mItemDescLabel->setCaption("Description: " + info.getDescription()); + mItemEffectLabel->setCaption("Effect: " + info.getEffect()); + } + else + { + mItemDescLabel->setCaption("Description:"); + mItemEffectLabel->setCaption("Effect:"); } } diff --git a/src/gui/buy.h b/src/gui/buy.h index 0ddea4c4..f5c163e1 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -27,17 +27,19 @@ #include #include "window.h" +#include "selectionlistener.h" #include "../guichanfwd.h" class ShopItems; +class ListBox; /** * The buy dialog. * * \ingroup Interface */ -class BuyDialog : public Window, public gcn::ActionListener +class BuyDialog : public Window, public gcn::ActionListener, SelectionListener { public: /** @@ -78,9 +80,11 @@ class BuyDialog : public Window, public gcn::ActionListener int getNumberOfElements(); /** - * Mouse callback + * Updates the labels according to the selected item. + * + * @see SelectionListener::selectionChanged */ - void mouseClick(int x, int y, int buton, int count); + void selectionChanged(const SelectionEvent &event); /** * Returns the name of item number i in the shop inventory. @@ -92,7 +96,7 @@ class BuyDialog : public Window, public gcn::ActionListener gcn::Button *mQuitButton; gcn::Button *mIncreaseButton; gcn::Button *mDecreaseButton; - gcn::ListBox *mItemList; + ListBox *mItemList; gcn::ScrollArea *mScrollArea; gcn::Label *mItemDescLabel; gcn::Label *mItemEffectLabel; diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 042a5be8..3e6c4a5f 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -224,6 +224,28 @@ void CharSelectDialog::logic() updatePlayerInfo(); } +bool CharSelectDialog::selectByName(const std::string &name) +{ + if (mCharInfo->isLocked()) + return false; + + unsigned int oldPos = mCharInfo->getPos(); + + mCharInfo->select(0); + do { + LocalPlayer *player = mCharInfo->getEntry(); + + if (player && player->getName() == name) + return true; + + mCharInfo->next(); + } while (mCharInfo->getPos()); + + mCharInfo->select(oldPos); + + return false; +} + std::string CharSelectDialog::getName() { return mNameLabel->getCaption(); diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 06881bb5..6d9d1a83 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -54,6 +54,8 @@ class CharSelectDialog : public Window, public gcn::ActionListener void logic(); + bool selectByName(const std::string &name); + /** * Returns name of selected player */ diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 2cbffde4..ec525c47 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -65,7 +65,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) continue; } - image = item->getInfo()->getImage(); + image = item->getInfo().getImage(); dynamic_cast(graphics)->drawImage( image, 36 * (i % 4) + 10, 36 * (i / 4) + 25); } @@ -76,7 +76,7 @@ void EquipmentWindow::draw(gcn::Graphics *graphics) return; } - image = item->getInfo()->getImage(); + image = item->getInfo().getImage(); dynamic_cast(graphics)->drawImage(image, 160, 25); graphics->drawText(toString(item->getQuantity()), 170, 62, diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index ecf81712..33852f2b 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -322,6 +322,19 @@ Gui::mousePress(int mx, int my, int button) } } } + + if (button == gcn::MouseInput::MIDDLE) + { + // Find the being nearest to the clicked position + Being *target = beingManager->findNearestLivingBeing( + tilex, tiley, + 20, Being::MONSTER); + + if (target) + { + player_node->setTarget(target); + } + } } void diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 063e8836..ea0fd8c0 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -55,6 +55,8 @@ InventoryWindow::InventoryWindow(): mDropButton = new Button("Drop", "drop", this); mItems = new ItemContainer(player_node->mInventory.get()); + mItems->addSelectionListener(this); + mInvenScroll = new ScrollArea(mItems); mInvenScroll->setPosition(8, 8); mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); @@ -123,33 +125,46 @@ void InventoryWindow::action(const std::string &eventId, gcn::Widget *widget) } } -void InventoryWindow::mouseClick(int x, int y, int button, int count) +void InventoryWindow::selectionChanged(const SelectionEvent &event) { - Window::mouseClick(x, y, button, count); - Item *item = mItems->getItem(); - if (!item) { - return; + // Update name, effect and description + if (!item) + { + mItemNameLabel->setCaption("Name:"); + mItemEffectLabel->setCaption("Effect:"); + mItemDescriptionLabel->setCaption("Description:"); + } + else + { + const ItemInfo& itemInfo = item->getInfo(); + std::string SomeText; + SomeText = "Name: " + itemInfo.getName(); + mItemNameLabel->setCaption(SomeText); + SomeText = "Effect: " + itemInfo.getEffect(); + mItemEffectLabel->setCaption(SomeText); + SomeText = "Description: " + itemInfo.getDescription(); + mItemDescriptionLabel->setCaption(SomeText); + + mItemNameLabel->adjustSize(); + mItemEffectLabel->adjustSize(); + mItemDescriptionLabel->adjustSize(); } +} - // Show Name and Description - std::string SomeText; - SomeText = "Name: " + item->getInfo()->getName(); - mItemNameLabel->setCaption(SomeText); - mItemNameLabel->adjustSize(); - SomeText = "Effect: " + item->getInfo()->getEffect(); - mItemEffectLabel->setCaption(SomeText); - mItemEffectLabel->adjustSize(); - SomeText = "Description: " + item->getInfo()->getDescription(); - mItemDescriptionLabel->setCaption(SomeText); - mItemDescriptionLabel->adjustSize(); +void InventoryWindow::mouseClick(int x, int y, int button, int count) +{ + Window::mouseClick(x, y, button, count); if (button == gcn::MouseInput::RIGHT) { - /* - * convert relative to the window coordinates to - * absolute screen coordinates + Item *item = mItems->getItem(); + + if (!item) return; + + /* Convert relative to the window coordinates to + * absolute screen coordinates. */ int mx = x + getX(); int my = y + getY(); @@ -223,11 +238,6 @@ void InventoryWindow::loadWindowState() updateWidgets(); } -void InventoryWindow::setDefaultSize(int defaultX, int defaultY, int defaultWidth, int defaultHeight) -{ - Window::setDefaultSize(defaultX, defaultY, defaultWidth, defaultHeight); -} - void InventoryWindow::resetToDefaultSize() { Window::resetToDefaultSize(); diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index da7a7ef2..d46e91e7 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -27,6 +27,7 @@ #include #include "window.h" +#include "selectionlistener.h" #include "../guichanfwd.h" @@ -38,7 +39,7 @@ class ItemContainer; * * \ingroup Interface */ -class InventoryWindow : public Window, gcn::ActionListener +class InventoryWindow : public Window, gcn::ActionListener, SelectionListener { public: /** @@ -47,14 +48,14 @@ class InventoryWindow : public Window, gcn::ActionListener InventoryWindow(); /** - * Logic (updates buttons and weight information) + * Logic (updates buttons and weight information). */ void logic(); /** * Called when receiving actions from the widgets. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const std::string &eventId, gcn::Widget *widget); void mouseClick(int x, int y, int button, int count); @@ -64,14 +65,19 @@ class InventoryWindow : public Window, gcn::ActionListener void loadWindowState(); - void setDefaultSize(int defaultX, int defaultY, int defaultWidth, int defaultHeight); - void resetToDefaultSize(); + /** + * Updates labels to currently selected item. + * + * @see SelectionListener::selectionChanged. + */ + void selectionChanged(const SelectionEvent &event); + private: - void updateButtons(); /** Updates button states */ + void updateButtons(); /**< Updates button states. */ - void updateWidgets(); /** Updates widgets size/position */ + void updateWidgets(); /**< Updates widgets size/position. */ ItemContainer *mItems; diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index c7c55fd9..5bcd000d 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -25,6 +25,8 @@ #include +#include "selectionlistener.h" + #include "../graphics.h" #include "../inventory.h" #include "../item.h" @@ -38,14 +40,14 @@ #include "../utils/tostring.h" ItemContainer::ItemContainer(Inventory *inventory): - mInventory(inventory) + mInventory(inventory), + mSelectedItem(NULL) { ResourceManager *resman = ResourceManager::getInstance(); mSelImg = resman->getImage("graphics/gui/selection.png"); if (!mSelImg) logger->error("Unable to load selection.png"); - mSelectedItem = 0; // No item selected mMaxItems = mInventory->getLastUsedSlot() - 1; // Count from 0, usage from 2 addMouseListener(this); @@ -84,7 +86,7 @@ void ItemContainer::draw(gcn::Graphics* graphics) // sure somewhere else) if (mSelectedItem && mSelectedItem->getQuantity() <= 0) { - mSelectedItem = 0; + selectNone(); } /* @@ -111,7 +113,7 @@ void ItemContainer::draw(gcn::Graphics* graphics) // Draw item icon Image* image; - if ((image = item->getInfo()->getImage()) != NULL) + if ((image = item->getInfo().getImage()) != NULL) { dynamic_cast(graphics)->drawImage( image, itemX, itemY); @@ -150,7 +152,28 @@ Item* ItemContainer::getItem() void ItemContainer::selectNone() { - mSelectedItem = 0; + setSelectedItem(NULL); +} + +void ItemContainer::setSelectedItem(Item *item) +{ + if (mSelectedItem != item) + { + mSelectedItem = item; + fireSelectionChangedEvent(); + } +} + +void ItemContainer::fireSelectionChangedEvent() +{ + SelectionEvent event(this); + SelectionListeners::iterator i_end = mListeners.end(); + SelectionListeners::iterator i; + + for (i = mListeners.begin(); i != i_end; ++i) + { + (*i)->selectionChanged(event); + } } void ItemContainer::mousePress(int mx, int my, int button) @@ -166,6 +189,6 @@ void ItemContainer::mousePress(int mx, int my, int button) if (index > INVENTORY_SIZE) { index = INVENTORY_SIZE - 1; } - mSelectedItem = mInventory->getItem(index); + setSelectedItem(mInventory->getItem(index)); } } diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index f52f37ec..a2d5f0f7 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -27,9 +27,12 @@ #include #include +#include + class Image; class Inventory; class Item; +class SelectionListener; /** * An item container. Used to show items in inventory and trade dialog. @@ -76,16 +79,46 @@ class ItemContainer : public gcn::Widget, public gcn::MouseListener Item* getItem(); /** - * Set selected item to -1. + * Sets selected item to NULL. */ void selectNone(); + /** + * Adds a listener to the list that's notified each time a change to + * the selection occurs. + */ + void addSelectionListener(SelectionListener *listener) + { + mListeners.push_back(listener); + } + + /** + * Removes a listener from the list that's notified each time a change + * to the selection occurs. + */ + void removeSelectionListener(SelectionListener *listener) + { + mListeners.remove(listener); + } + private: + /** + * Sets the currently selected item. + */ + void setSelectedItem(Item *item); + + /** + * Sends out selection events to the list of selection listeners. + */ + void fireSelectionChangedEvent(); + Inventory *mInventory; Image *mSelImg; Item *mSelectedItem; int mMaxItems; + + std::list mListeners; }; #endif diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index df03b81b..14626d06 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -23,12 +23,16 @@ #include "listbox.h" +#include "selectionlistener.h" + #include #include #include +#include ListBox::ListBox(gcn::ListModel *listModel): - gcn::ListBox(listModel) + gcn::ListBox(listModel), + mMousePressed(false) { } @@ -45,8 +49,8 @@ void ListBox::draw(gcn::Graphics *graphics) // Draw rectangle below the selected list element if (mSelected >= 0) { - graphics->fillRectangle( - gcn::Rectangle(0, fontHeight * mSelected, getWidth(), fontHeight)); + graphics->fillRectangle(gcn::Rectangle(0, fontHeight * mSelected, + getWidth(), fontHeight)); } // Draw the list elements @@ -55,3 +59,50 @@ void ListBox::draw(gcn::Graphics *graphics) graphics->drawText(mListModel->getElementAt(i), 1, y); } } + +void ListBox::setSelected(int selected) +{ + gcn::ListBox::setSelected(selected); + fireSelectionChangedEvent(); +} + +void ListBox::mousePress(int x, int y, int button) +{ + gcn::ListBox::mousePress(x, y, button); + + if (button == gcn::MouseInput::LEFT && hasMouse()) + { + mMousePressed = true; + } +} + +void ListBox::mouseRelease(int x, int y, int button) +{ + gcn::ListBox::mouseRelease(x, y, button); + + mMousePressed = false; +} + +void ListBox::mouseMotion(int x, int y) +{ + gcn::ListBox::mouseMotion(x, y); + + // Pretend mouse is pressed continuously while dragged. Causes list + // selection to be updated as is default in many GUIs. + if (mMousePressed) + { + mousePress(x, y, gcn::MouseInput::LEFT); + } +} + +void ListBox::fireSelectionChangedEvent() +{ + SelectionEvent event(this); + SelectionListeners::iterator i_end = mListeners.end(); + SelectionListeners::iterator i; + + for (i = mListeners.begin(); i != i_end; ++i) + { + (*i)->selectionChanged(event); + } +} diff --git a/src/gui/listbox.h b/src/gui/listbox.h index 5999f7a7..c1932f54 100644 --- a/src/gui/listbox.h +++ b/src/gui/listbox.h @@ -26,10 +26,12 @@ #include +class SelectionListener; + /** * A list box, meant to be used inside a scroll area. Same as the Guichan list * box except this one doesn't have a background, instead completely relying - * on the scroll area. + * on the scroll area. It also adds selection listener functionality. * * \ingroup GUI */ @@ -45,6 +47,43 @@ class ListBox : public gcn::ListBox * Draws the list box. */ void draw(gcn::Graphics *graphics); + + void mousePress(int x, int y, int button); + void mouseRelease(int x, int y, int button); + void mouseMotion(int x, int y); + + /** + * Adds a listener to the list that's notified each time a change to + * the selection occurs. + */ + void addSelectionListener(SelectionListener *listener) + { + mListeners.push_back(listener); + } + + /** + * Removes a listener from the list that's notified each time a change + * to the selection occurs. + */ + void removeSelectionListener(SelectionListener *listener) + { + mListeners.remove(listener); + } + + /** + * Sets the index of the selected element. + */ + void setSelected(int selected); + + private: + /** + * Sends out selection events to the list of selection listeners. + */ + void fireSelectionChangedEvent(); + + bool mMousePressed; /**< Keeps track of mouse pressed status. */ + + std::list mListeners; }; #endif diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index db6d4f15..69c5eb6e 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -76,10 +76,10 @@ void Minimap::draw(gcn::Graphics *graphics) mMapImage, getPadding(), getTitleBarHeight()); } - Beings *beings = beingManager->getAll(); + Beings &beings = beingManager->getAll(); BeingIterator bi; - for (bi = beings->begin(); bi != beings->end(); bi++) + for (bi = beings.begin(); bi != beings.end(); bi++) { Being *being = (*bi); int dotSize = 1; diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index ba97d54c..46cd7e85 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -97,7 +97,7 @@ void PlayerBox::draw(gcn::Graphics *graphics) if (mHairStyle > 0 && mHairColor < NR_HAIR_COLORS && mHairStyle < NR_HAIR_STYLES) { - int hf = 9 * mHairColor; + int hf = 5 * mHairColor; if (hf >= 0 && hf < (int)hairset[mHairStyle]->size()) { dynamic_cast(graphics)->drawImage( hairset[mHairStyle - 1]->get(hf), 35, 7); diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 59316de1..ab81f7d0 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -106,7 +106,7 @@ void PopupMenu::showPopup(int x, int y, FloorItem *floorItem) mBrowserBox->clearRows(); // Floor item can be picked up (single option, candidate for removal) - std::string name = itemDb->getItemInfo(mFloorItem->getItemId())->getName(); + std::string name = itemDb->getItemInfo(mFloorItem->getItemId()).getName(); mBrowserBox->addRow("@@pickup|Pick Up " + name + "@@"); //browserBox->addRow("@@look|Look To@@"); diff --git a/src/gui/selectionlistener.h b/src/gui/selectionlistener.h new file mode 100644 index 00000000..a2fc6533 --- /dev/null +++ b/src/gui/selectionlistener.h @@ -0,0 +1,78 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id: selectionlistener.h 2651 2006-09-03 16:47:48Z b_lindeijer $ + */ + +#ifndef _TMW_SELECTIONLISTENER_H__ +#define _TMW_SELECTIONLISTENER_H__ + +#include + +/** + * An event that characterizes a change in the current selection. + * + * \ingroup GUI + */ +class SelectionEvent +{ + public: + /** + * Constructor. + */ + SelectionEvent(gcn::Widget *source): + mSource(source) + { + } + + /** + * The widget from which the event originated. + */ + gcn::Widget* getSource() const + { + return mSource; + } + + private: + gcn::Widget *mSource; +}; + +/** + * The listener that's notified when a selection value changes. + * + * \ingroup GUI + */ +class SelectionListener +{ + public: + /** + * Virtual destructor. + */ + virtual ~SelectionListener() {} + + /** + * Called whenever the value of the selection changes. + */ + virtual void selectionChanged(const SelectionEvent &event) = 0; +}; + +typedef std::list SelectionListeners; + +#endif diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 33813271..d6d8cad5 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -94,6 +94,7 @@ SellDialog::SellDialog(): mSlider->setEventId("mSlider"); mItemList->addActionListener(this); + mItemList->addSelectionListener(this); mSlider->addActionListener(this); add(scrollArea); @@ -141,7 +142,7 @@ void SellDialog::addItem(Item *item, int price) ITEM_SHOP item_shop; - item_shop.name = item->getInfo()->getName() + " " + toString(price) + " GP"; + item_shop.name = item->getInfo().getName() + " " + toString(price) + " GP"; item_shop.price = price; item_shop.index = item->getInvIndex(); item_shop.id = item->getId(); @@ -155,7 +156,8 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) { int selectedItem = mItemList->getSelected(); - if (eventId == "item") { + if (eventId == "item") + { mAmountItems = 0; mSlider->setValue(0); mDecreaseButton->setEnabled(false); @@ -188,19 +190,22 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) bool updateButtonsAndLabels = false; - if (eventId == "mSlider") { + if (eventId == "mSlider") + { mAmountItems = (int)(mSlider->getValue() * mMaxItems); updateButtonsAndLabels = true; } - else if (eventId == "+") { + else if (eventId == "+") + { assert(mAmountItems < mMaxItems); mAmountItems++; mSlider->setValue(double(mAmountItems)/double(mMaxItems)); updateButtonsAndLabels = true; } - else if (eventId == "-") { + else if (eventId == "-") + { assert(mAmountItems > 0); mAmountItems--; @@ -208,7 +213,8 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) updateButtonsAndLabels = true; } - else if (eventId == "sell") { + else if (eventId == "sell") + { // Attempt sell assert(mAmountItems > 0 && mAmountItems <= mMaxItems); @@ -234,7 +240,8 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) } // If anything changed, we need to update the buttons and labels - if (updateButtonsAndLabels) { + if (updateButtonsAndLabels) + { // Update labels mQuantityLabel->setCaption(toString(mAmountItems)); mQuantityLabel->adjustSize(); @@ -250,16 +257,21 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) } } -void SellDialog::mouseClick(int x, int y, int button, int count) +void SellDialog::selectionChanged(const SelectionEvent &event) { - Window::mouseClick(x, y, button, count); - int selectedItem = mItemList->getSelected(); + if (selectedItem > -1) { - mItemDescLabel->setCaption("Description: " + - itemDb->getItemInfo(mShopItems->at(selectedItem).id)->getDescription()); - mItemEffectLabel->setCaption("Effect: " + - itemDb->getItemInfo(mShopItems->at(selectedItem).id)->getEffect()); + const ItemInfo &info = + itemDb->getItemInfo(mShopItems->at(selectedItem).id); + + mItemDescLabel->setCaption("Description: " + info.getDescription()); + mItemEffectLabel->setCaption("Effect: " + info.getEffect()); + } + else + { + mItemDescLabel->setCaption("Description"); + mItemEffectLabel->setCaption("Effect"); } } diff --git a/src/gui/sell.h b/src/gui/sell.h index be5185bd..69f8b089 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -27,19 +27,20 @@ #include #include "window.h" +#include "selectionlistener.h" #include "../guichanfwd.h" class Item; class ShopItems; - +class ListBox; /** * The sell dialog. * * \ingroup Interface */ -class SellDialog : public Window, public gcn::ActionListener +class SellDialog : public Window, gcn::ActionListener, SelectionListener { public: /** @@ -70,15 +71,17 @@ class SellDialog : public Window, public gcn::ActionListener void action(const std::string& eventId, gcn::Widget* widget); /** - * Mouse callback + * Updates labels according to selected item. + * + * @see SelectionListener::selectionChanged */ - void mouseClick(int x, int y, int buton, int count); + void selectionChanged(const SelectionEvent &event); private: gcn::Button *mSellButton; gcn::Button *mIncreaseButton; gcn::Button *mDecreaseButton; - gcn::ListBox *mItemList; + ListBox *mItemList; gcn::Label *mMoneyLabel; gcn::Label *mItemDescLabel; gcn::Label *mItemEffectLabel; diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index d12ace75..78b10498 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -43,7 +43,7 @@ Setup::Setup(): Window("Setup") { int width = 230; - int height = 225; + int height = 245; setContentSize(width, height); const char *buttonNames[] = { @@ -58,7 +58,7 @@ Setup::Setup(): } TabbedContainer *panel = new TabbedContainer(); - panel->setDimension(gcn::Rectangle(5, 5, 220, 185)); + panel->setDimension(gcn::Rectangle(5, 5, 220, 205)); panel->setOpaque(false); SetupTab *tab; diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 7c72975a..7a4aae03 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -106,7 +106,7 @@ Setup_Video::Setup_Video(): mOpenGLEnabled(config.getValue("opengl", 0)), mCustomCursorEnabled(config.getValue("customcursor", 1)), mOpacity(config.getValue("guialpha", 0.8)), - mFps((int)config.getValue("fpslimit", 50)), + mFps((int)config.getValue("fpslimit", 60)), mModeListModel(new ModeListModel()), mModeList(new ListBox(mModeListModel)), mFsCheckBox(new CheckBox("Full screen", mFullScreenEnabled)), @@ -121,7 +121,10 @@ Setup_Video::Setup_Video(): mScrollLazinessField(new TextField()), mOriginalScrollRadius((int) config.getValue("ScrollRadius", 32)), mScrollRadiusSlider(new Slider(0, 128)), - mScrollRadiusField(new TextField()) + mScrollRadiusField(new TextField()), + mOverlayDetail((int) config.getValue("OverlayDetail", 2)), + mOverlayDetailSlider(new Slider(0, 2)), + mOverlayDetailField(new gcn::Label("")) { setOpaque(false); @@ -163,6 +166,8 @@ Setup_Video::Setup_Video(): mScrollRadiusField->setEventId("scrollradiusfield"); mScrollLazinessSlider->setEventId("scrolllazinessslider"); mScrollLazinessField->setEventId("scrolllazinessfield"); + mOverlayDetailSlider->setEventId("overlaydetailslider"); + mOverlayDetailField->setEventId("overlaydetailfield"); mCustomCursorCheckBox->addActionListener(this); mAlphaSlider->addActionListener(this); @@ -173,6 +178,8 @@ Setup_Video::Setup_Video(): mScrollRadiusField->addKeyListener(this); mScrollLazinessSlider->addActionListener(this); mScrollLazinessField->addKeyListener(this); + mOverlayDetailSlider->addActionListener(this); + mOverlayDetailField->addKeyListener(this); mScrollRadiusSlider->setDimension(gcn::Rectangle(10, 120, 75, 10)); gcn::Label *scrollRadiusLabel = new gcn::Label("Scroll radius"); @@ -190,6 +197,25 @@ Setup_Video::Setup_Video(): mScrollLazinessField->setText(toString(mOriginalScrollLaziness)); mScrollLazinessSlider->setValue(mOriginalScrollLaziness); + mOverlayDetailSlider->setDimension(gcn::Rectangle(10, 160, 75, 10)); + gcn::Label *overlayDetailLabel = new gcn::Label("Ambient FX"); + overlayDetailLabel->setPosition(90, 160); + mOverlayDetailField->setPosition(180, 160); + mOverlayDetailField->setWidth(30); + switch (mOverlayDetail) + { + case 0: + mOverlayDetailField->setCaption("off"); + break; + case 1: + mOverlayDetailField->setCaption("low"); + break; + case 2: + mOverlayDetailField->setCaption("high"); + break; + } + mOverlayDetailSlider->setValue(mOverlayDetail); + add(scrollArea); add(mFsCheckBox); add(mOpenGLCheckBox); @@ -205,6 +231,9 @@ Setup_Video::Setup_Video(): add(mScrollLazinessSlider); add(scrollLazinessLabel); add(mScrollLazinessField); + add(mOverlayDetailSlider); + add(overlayDetailLabel); + add(mOverlayDetailField); } Setup_Video::~Setup_Video() @@ -258,6 +287,7 @@ void Setup_Video::apply() mFullScreenEnabled = config.getValue("screen", 0); mCustomCursorEnabled = config.getValue("customcursor", 1); mOpacity = config.getValue("guialpha", 0.8); + mOverlayDetail = (int)config.getValue("OverlayDetail", 2); mOpenGLEnabled = config.getValue("opengl", 0); } @@ -288,6 +318,7 @@ void Setup_Video::cancel() mOpenGLCheckBox->setMarked(mOpenGLEnabled); mCustomCursorCheckBox->setMarked(mCustomCursorEnabled); mAlphaSlider->setValue(mOpacity); + mOverlayDetailSlider->setValue(mOverlayDetail); mScrollRadiusField->setText(toString(mOriginalScrollRadius)); mScrollLazinessField->setText(toString(mOriginalScrollLaziness)); @@ -328,6 +359,23 @@ void Setup_Video::action(const std::string &event, gcn::Widget *widget) mScrollLazinessField->setText(toString(val)); config.setValue("ScrollLaziness", val); } + else if (event == "overlaydetailslider") + { + int val = (int)mOverlayDetailSlider->getValue(); + switch (val) + { + case 0: + mOverlayDetailField->setCaption("off"); + break; + case 1: + mOverlayDetailField->setCaption("low"); + break; + case 2: + mOverlayDetailField->setCaption("high"); + break; + } + config.setValue("OverlayDetail", val); + } else if (event == "fpslimitcheckbox") { if (mFpsCheckBox->isMarked()) diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index a3fd8884..482d1c65 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -73,6 +73,10 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, gcn::Slider *mScrollRadiusSlider; gcn::TextField *mScrollRadiusField; + int mOverlayDetail; + gcn::Slider *mOverlayDetailSlider; + gcn::Label *mOverlayDetailField; + void updateSliders(bool originalValues); diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 0cd49013..44efbdb1 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -58,12 +58,14 @@ TradeWindow::TradeWindow(): mTradeButton = new Button("Trade", "trade", this); mMyItemContainer = new ItemContainer(mMyInventory.get()); + mMyItemContainer->addSelectionListener(this); mMyItemContainer->setPosition(2, 2); mMyScroll = new ScrollArea(mMyItemContainer); mMyScroll->setPosition(8, 8); mPartnerItemContainer = new ItemContainer(mPartnerInventory.get()); + mPartnerItemContainer->addSelectionListener(this); mPartnerItemContainer->setPosition(2, 58); mPartnerScroll = new ScrollArea(mPartnerItemContainer); @@ -219,53 +221,54 @@ void TradeWindow::tradeItem(Item *item, int quantity) outMsg.writeLong(quantity); } -void TradeWindow::mouseClick(int x, int y, int button, int count) +void TradeWindow::selectionChanged(const SelectionEvent &event) { - Window::mouseClick(x, y, button, count); - Item *item; - // mMyItems selected - if (x >= mMyScroll->getX() + 3 - && x <= mMyScroll->getX() + mMyScroll->getWidth() - 10 - && y >= mMyScroll->getY() + 16 - && y <= mMyScroll->getY() + mMyScroll->getHeight() + 15 - && (item = mMyItemContainer->getItem())) + /* If an item is selected in one container, make sure no item is selected + * in the other container. + */ + if (event.getSource() == mMyItemContainer && + (item = mMyItemContainer->getItem())) { - mPartnerItemContainer->selectNone(); - // mPartnerItems selected + mPartnerItemContainer->selectNone(); } - else if (x >= mPartnerScroll->getX() + 3 - && x <= mPartnerScroll->getX() + mPartnerScroll->getWidth() - 20 - && y >= mPartnerScroll->getY() + 16 - && y <= mPartnerScroll->getY() + mPartnerScroll->getHeight() + 15 - && (item = mPartnerItemContainer->getItem())) + else if ((item = mPartnerItemContainer->getItem())) { - mMyItemContainer->selectNone(); - } else { - return; + mMyItemContainer->selectNone(); } - // Show Name and Description - std::string SomeText; - SomeText = "Name: " + item->getInfo()->getName(); - mItemNameLabel->setCaption(SomeText); - mItemNameLabel->adjustSize(); - SomeText = "Description: " + item->getInfo()->getDescription(); - mItemDescriptionLabel->setCaption(SomeText); - mItemDescriptionLabel->adjustSize(); + // Update name and description + if (!item) + { + mItemNameLabel->setCaption("Name:"); + mItemDescriptionLabel->setCaption("Description:"); + } + else + { + std::string SomeText; + SomeText = "Name: " + item->getInfo().getName(); + mItemNameLabel->setCaption(SomeText); + mItemNameLabel->adjustSize(); + SomeText = "Description: " + item->getInfo().getDescription(); + mItemDescriptionLabel->setCaption(SomeText); + mItemDescriptionLabel->adjustSize(); + } } void TradeWindow::action(const std::string &eventId, gcn::Widget *widget) { Item *item = inventoryWindow->getItem(); - if (eventId == "add") { - if (!item) { + if (eventId == "add") + { + if (!item) + { return; } - if (mMyInventory->getFreeSlot() < 1) { + if (mMyInventory->getFreeSlot() < 1) + { return; } diff --git a/src/gui/trade.h b/src/gui/trade.h index fe60aac5..ebd05a52 100644 --- a/src/gui/trade.h +++ b/src/gui/trade.h @@ -29,6 +29,7 @@ #include #include "window.h" +#include "selectionlistener.h" #include "../guichanfwd.h" @@ -42,7 +43,7 @@ class ScrollArea; * * \ingroup Interface */ -class TradeWindow : public Window, gcn::ActionListener +class TradeWindow : public Window, gcn::ActionListener, SelectionListener { public: /** @@ -102,14 +103,15 @@ class TradeWindow : public Window, gcn::ActionListener tradeItem(Item *item, int quantity); /** - * Called on mouse click. + * Updates the labels and makes sure only one item is selected in + * either my inventory or partner inventory. */ - void mouseClick(int x, int y, int button, int count); + void selectionChanged(const SelectionEvent &event); /** * Called when receiving actions from the widgets. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const std::string &eventId, gcn::Widget *widget); private: typedef std::auto_ptr InventoryPtr; diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 77a026fe..00b10406 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -48,9 +48,9 @@ UpdaterWindow::UpdaterWindow(): Window("Updating..."), mThread(NULL), mMutex(NULL), mDownloadStatus(UPDATE_NEWS), mUpdateHost(""), mCurrentFile("news.txt"), mBasePath(""), - mStoreInMemory(true), mDownloadComplete(true), mDownloadedBytes(0), - mMemoryBuffer(NULL), mCurlError(new char[CURL_ERROR_SIZE]), - mFileIndex(0) + mStoreInMemory(true), mDownloadComplete(true), mUserCancel(false), + mDownloadedBytes(0), mMemoryBuffer(NULL), + mCurlError(new char[CURL_ERROR_SIZE]), mFileIndex(0) { mCurlError[0] = 0; @@ -133,6 +133,8 @@ void UpdaterWindow::action(const std::string &eventId, gcn::Widget *widget) { if (eventId == "cancel") { + // Register the user cancel + mUserCancel=true; // Skip the updating process if (mDownloadStatus == UPDATE_COMPLETE) { @@ -329,7 +331,15 @@ void UpdaterWindow::logic() case UPDATE_ERROR: if (mThread) { - SDL_WaitThread(mThread, NULL); + if(mUserCancel){ + // Kill the thread, because user has canceled + SDL_KillThread(mThread); + // Set the flag to false again + mUserCancel = false; + } + else{ + SDL_WaitThread(mThread, NULL); + } mThread = NULL; } addRow(""); diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h index 8a168be8..5016036d 100644 --- a/src/gui/updatewindow.h +++ b/src/gui/updatewindow.h @@ -161,6 +161,11 @@ class UpdaterWindow : public Window, public gcn::ActionListener */ bool mDownloadComplete; + /** + * Flag that show if the user has canceled the update + */ + bool mUserCancel; + /** * Byte count currently downloaded in mMemoryBuffer. */ diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 2172baa8..c7860021 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -249,16 +249,18 @@ void Window::setSticky(bool sticky) mSticky = sticky; } -bool Window::isSticky() { +bool Window::isSticky() +{ return mSticky; } -void Window::setVisible(bool visible) { - if(isSticky()) +void Window::setVisible(bool visible) +{ + if (isSticky()) { gcn::Window::setVisible(true); - } - else + } + else { gcn::Window::setVisible(visible); } diff --git a/src/item.h b/src/item.h index c21f5ddf..1375886e 100644 --- a/src/item.h +++ b/src/item.h @@ -118,7 +118,7 @@ class Item /** * Returns information about this item type. */ - ItemInfo* + const ItemInfo& getInfo() const { return itemDb->getItemInfo(mId); } protected: diff --git a/src/localplayer.h b/src/localplayer.h index 7d5aef87..dbf2a147 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -96,12 +96,17 @@ class LocalPlayer : public Player * Sets the trading state of the player, i.e. whether or not he is * currently involved into some trade. */ - void setTrading(bool trading) { mTrading = trading; }; + void setTrading(bool trading) { mTrading = trading; } void attack(Being *target=NULL, bool keep=false); void stopAttack(); Being* getTarget() const; + /** + * Sets the target being of the player. + */ + void setTarget(Being* target) { mTarget = target; } + void walk(unsigned char dir); /** diff --git a/src/main.cpp b/src/main.cpp index 9d2a1e64..f881ddad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -107,6 +107,33 @@ namespace { } errorListener; } +/** + * A structure holding the values of various options that can be passed from + * the command line. + */ +struct Options +{ + /** + * Constructor. + */ + Options(): + printHelp(false), + skipUpdate(false), + chooseDefault(false), + serverPort(0) + {}; + + bool printHelp; + bool skipUpdate; + bool chooseDefault; + std::string playername; + std::string password; + std::string configPath; + + std::string serverName; + short serverPort; +}; + /** * Initializes the home directory. On UNIX and FreeBSD, ~/.tmw is used. On * Windows and other systems we use the current working directory. @@ -133,7 +160,7 @@ void initHomeDir() /** * Initialize configuration. */ -void initConfiguration() +void initConfiguration(const Options &options) { // Fill configuration with defaults config.setValue("host", "animesites.de"); @@ -158,7 +185,10 @@ void initConfiguration() // Checking if the configuration file exists... otherwise create it with // default options. FILE *tmwFile = 0; - std::string configPath = homeDir + "/config.xml"; + std::string configPath = options.configPath; + if (configPath == "") { + configPath = homeDir + "/config.xml"; + } tmwFile = fopen(configPath.c_str(), "r"); // If we can't read it, it doesn't exist ! @@ -176,7 +206,7 @@ void initConfiguration() } /** - * Do all initialization stuff + * Do all initialization stuff. */ void init_engine() { @@ -279,7 +309,8 @@ void init_engine() sound.init(); } sound.setSfxVolume((int)config.getValue("sfxVolume", defaultSfxVolume)); - sound.setMusicVolume((int)config.getValue("musicVolume", defaultMusicVolume)); + sound.setMusicVolume((int)config.getValue("musicVolume", + defaultMusicVolume)); } catch (const char *err) { state = STATE_ERROR; @@ -311,33 +342,6 @@ void exit_engine() ResourceManager::deleteInstance(); } -/** - * A structure holding the values of various options that can be passed from - * the command line. - */ -struct Options -{ - /** - * Constructor. - */ - Options(): - printHelp(false), - skipUpdate(false), - chooseDefault(false), - serverPort(0) - {}; - - bool printHelp; - bool skipUpdate; - bool chooseDefault; - std::string playername; - std::string password; - - std::string serverName; - short serverPort; - -}; - void printHelp() { std::cout @@ -351,12 +355,13 @@ void printHelp() << std::endl << " -s --server : Login Server name or IP" << std::endl << " -o --port : Login Server Port" << std::endl - << " -p --playername : Login with this player" << std::endl; + << " -p --playername : Login with this player" << std::endl + << " -C --configfile : Configuration file to use" << std::endl; } void parseOptions(int argc, char *argv[], Options &options) { - const char *optstring = "huU:P:Dp:s:o:"; + const char *optstring = "huU:P:Dp:s:o:C:"; const struct option long_options[] = { { "help", no_argument, 0, 'h' }, @@ -367,6 +372,7 @@ void parseOptions(int argc, char *argv[], Options &options) { "server", required_argument, 0, 's' }, { "port", required_argument, 0, 'o' }, { "playername", required_argument, 0, 'p' }, + { "configfile", required_argument, 0, 'C' }, { 0 } }; @@ -403,6 +409,9 @@ void parseOptions(int argc, char *argv[], Options &options) case 'p': options.playername = optarg; break; + case 'C': + options.configPath = optarg; + break; } } } @@ -480,6 +489,10 @@ void mapLogin(LoginData *loginData) { Network::registerHandler(&mapLoginHandler); + logger->log("Memorizing selected character %s", + player_node->getName().c_str()); + config.setValue("lastCharacter", player_node->getName()); + // Send connect messages with the magic token to game and chat servers MessageOut gameServerConnect(PGMSG_CONNECT); gameServerConnect.writeString(token, 32); @@ -510,7 +523,7 @@ int main(int argc, char *argv[]) PHYSFS_init(argv[0]); initHomeDir(); - initConfiguration(); + initConfiguration(options); // Configure logger logger = new Logger(); @@ -721,23 +734,16 @@ int main(int argc, char *argv[]) case STATE_CHAR_SELECT: logger->log("State: CHAR_SELECT"); currentDialog = new CharSelectDialog(&charInfo); - if (options.playername != "") { - n_character = 0; - while (((CharSelectDialog*) currentDialog)->getName() - != options.playername && - n_character < MAX_SLOT + 1) - { - ((CharSelectDialog*) currentDialog)->action("next", - NULL); - ((CharSelectDialog*) currentDialog)->updatePlayerInfo(); - n_character++; - } - n_character = MAX_SLOT + 1; - } - if (options.chooseDefault || options.playername != "") { - ((CharSelectDialog*)currentDialog)->action("ok", - NULL); - } + + if (((CharSelectDialog*)currentDialog)-> + selectByName(options.playername)) + options.chooseDefault = true; + else + ((CharSelectDialog*)currentDialog)->selectByName( + config.getValue("lastCharacter", "")); + + if (options.chooseDefault) + ((CharSelectDialog*)currentDialog)->action("ok", NULL); break; case STATE_ERROR: diff --git a/src/map.cpp b/src/map.cpp index 5063a754..3ccaafc0 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -63,8 +63,11 @@ Map::Map(int width, int height, int tileWidth, int tileHeight): mOnClosedList(1), mOnOpenList(2), mLastScrollX(0.0f), mLastScrollY(0.0f) { - mMetaTiles = new MetaTile[mWidth * mHeight]; - mTiles = new Image*[mWidth * mHeight * 3]; + int size = mWidth * mHeight; + + mMetaTiles = new MetaTile[size]; + mTiles = new Image*[size * 3]; + std::fill_n(mTiles, size * 3, (Image*)0); } Map::~Map() @@ -86,12 +89,17 @@ Map::~Map() void Map::setSize(int width, int height) { - mWidth = width; - mHeight = height; delete[] mMetaTiles; delete[] mTiles; - mMetaTiles = new MetaTile[mWidth * mHeight]; - mTiles = new Image*[mWidth * mHeight * 3]; + + mWidth = width; + mHeight = height; + + int size = width * height; + + mMetaTiles = new MetaTile[size]; + mTiles = new Image*[size * 3]; + std::fill_n(mTiles, size * 3, (Image*)0); } void @@ -330,8 +338,8 @@ Map::getWalk(int x, int y) /* // Check for collision with a being - Beings *beings = beingManager->getAll(); - for (BeingIterator i = beings->begin(); i != beings->end(); i++) { + Beings &beings = beingManager->getAll(); + for (BeingIterator i = beings.begin(); i != beings.end(); i++) { // job 45 is a portal, they don't collide if ((*i)->mX / 32 == x && (*i)->mY / 32 == y && (*i)->mJob != 45) { return false; diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp index c4192bc5..3f7e8709 100644 --- a/src/net/inventoryhandler.cpp +++ b/src/net/inventoryhandler.cpp @@ -92,14 +92,9 @@ void InventoryHandler::handleMessage(MessageIn &msg) if (msg.readByte()> 0) { chatWindow->chatLog("Unable to pick up item", BY_SERVER); } else { - ItemInfo *itemInfo = itemDb->getItemInfo(itemId); - if (itemInfo) { - chatWindow->chatLog("You picked up a " + - itemInfo->getName(), BY_SERVER); - } else { - chatWindow->chatLog("You picked up an unknown item", - BY_SERVER); - } + const ItemInfo &itemInfo = itemDb->getItemInfo(itemId); + chatWindow->chatLog("You picked up a " + + itemInfo.getName(), BY_SERVER); player_node->addInvItem(index, itemId, amount, equipType != 0); } break; diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 51899d3f..eb3a2409 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -260,11 +260,18 @@ void Image::unload() { mLoaded = false; - if (!mImage) return; + if (mImage) { + // Free the image surface. + SDL_FreeSurface(mImage); + mImage = NULL; + } - // Free the image surface. - SDL_FreeSurface(mImage); - mImage = NULL; +#ifdef USE_OPENGL + if (mGLImage) { + glDeleteTextures(1, &mGLImage); + mGLImage = 0; + } +#endif } Image *Image::getSubImage(int x, int y, int width, int height) @@ -341,7 +348,11 @@ SubImage::SubImage(Image *parent, GLuint image, SubImage::~SubImage() { - mImage = 0; // Avoid destruction of the image + // Avoid destruction of the image + mImage = 0; +#ifdef USE_OPENGL + mGLImage = 0; +#endif mParent->decRef(); } diff --git a/src/resources/image.h b/src/resources/image.h index 78751394..a1ab7f48 100644 --- a/src/resources/image.h +++ b/src/resources/image.h @@ -28,6 +28,13 @@ #include #ifdef USE_OPENGL + +/* The definition of OpenGL extensions by SDL is giving problems with recent + * gl.h headers, since they also include these definitions. As we're not using + * extensions anyway it's safe to just disable the SDL version. + */ +#define NO_SDL_GLEXT + #include #endif diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 5d39d832..b09d1cc0 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -23,22 +23,33 @@ #include "iteminfo.h" #include "resourcemanager.h" +#include "image.h" -Image* -ItemInfo::getImage() { - if (mImage == NULL && mImageName != "") { - mImage = ResourceManager::getInstance()->getImage(mImageName); + +ItemInfo::~ItemInfo() +{ + if (mImage != NULL) + { + mImage->decRef(); } - return mImage; } void -ItemInfo::setImage(const std::string &image) { +ItemInfo::setImage(const std::string &image) +{ mImageName = "graphics/items/" + image; -} -ItemInfo::~ItemInfo() { - if (mImage != NULL){ - mImage->decRef(); + if (mImageName != "") + { + if (mImage != NULL) + { + mImage->decRef(); + } + + mImage = ResourceManager::getInstance()->getImage(mImageName); + } + else + { + mImage = NULL; } } diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index afa2e857..9a04bb2e 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -26,7 +26,7 @@ #include -#include "image.h" +class Image; /** * Defines a class for storing item infos. @@ -40,8 +40,8 @@ class ItemInfo * Constructor. */ ItemInfo(): - mImage(NULL), mImageName(""), + mImage(NULL), mArt(0), mType(0), mWeight(0), @@ -53,19 +53,19 @@ class ItemInfo setArt(short art) { mArt = art; } short - getArt() { return mArt; } + getArt() const { return mArt; } void setName(const std::string &name) { mName = name; } - std::string - getName() { return mName; } + const std::string& + getName() const { return mName; } void setImage(const std::string &image); Image* - getImage(); + getImage() const { return mImage; } void setDescription(const std::string &description) @@ -73,32 +73,32 @@ class ItemInfo mDescription = description; } - std::string - getDescription() { return mDescription; } + const std::string& + getDescription() const { return mDescription; } void setEffect(const std::string &effect) { mEffect = effect; } - std::string - getEffect() { return mEffect; } + const std::string& + getEffect() const { return mEffect; } void setType(short type) { mType = type; } short - getType() { return mType; } + getType() const { return mType; } void setWeight(short weight) { mWeight = weight; } short - getWeight() { return mWeight; } + getWeight() const { return mWeight; } void setSlot(char slot) { mSlot = slot; } char - getSlot() { return mSlot; } + getSlot() const { return mSlot; } protected: /** @@ -106,8 +106,14 @@ class ItemInfo */ ~ItemInfo(); - Image* mImage; std::string mImageName; + + /* TODO (BL): I do not think the item info should keep a reference to + * the item icon. It would probably be better if this was kept in the + * Item class, so that the images can be lazily instantiated and also + * unloaded when no longer used. + */ + Image *mImage; short mArt; std::string mName; std::string mDescription; diff --git a/src/resources/itemmanager.cpp b/src/resources/itemmanager.cpp index a497b3c8..7d0b13f2 100644 --- a/src/resources/itemmanager.cpp +++ b/src/resources/itemmanager.cpp @@ -41,8 +41,7 @@ ItemManager::ItemManager() { - mUnknown = new ItemInfo(); - mUnknown->setName("Unknown item"); + mUnknown.setName("Unknown item"); ResourceManager *resman = ResourceManager::getInstance(); int size; @@ -163,14 +162,12 @@ ItemManager::~ItemManager() delete i->second; } mItemInfos.clear(); - - delete mUnknown; } -ItemInfo* +const ItemInfo& ItemManager::getItemInfo(int id) { ItemInfoIterator i = mItemInfos.find(id); - return (i != mItemInfos.end()) ? i->second : mUnknown; + return (i != mItemInfos.end()) ? *(i->second) : mUnknown; } diff --git a/src/resources/itemmanager.h b/src/resources/itemmanager.h index 06eee507..b1f2b95c 100644 --- a/src/resources/itemmanager.h +++ b/src/resources/itemmanager.h @@ -24,9 +24,9 @@ #ifndef _TMW_ITEM_MANAGER_H #define _TMW_ITEM_MANAGER_H -#include +#include "iteminfo.h" -class ItemInfo; +#include /** * Defines a class to load items database. @@ -44,14 +44,14 @@ class ItemManager */ ~ItemManager(); - ItemInfo *getItemInfo(int id); + const ItemInfo& getItemInfo(int id); protected: // Items database typedef std::map ItemInfos; typedef ItemInfos::iterator ItemInfoIterator; ItemInfos mItemInfos; - ItemInfo *mUnknown; + ItemInfo mUnknown; }; extern ItemManager *itemDb; diff --git a/src/tmw.rc b/src/tmw.rc index 31411b61..388b643d 100644 --- a/src/tmw.rc +++ b/src/tmw.rc @@ -7,8 +7,8 @@ A ICON MOVEABLE PURE LOADONCALL DISCARDABLE "data/icons/tmw-icon.ico" // TO CHANGE VERSION INFORMATION, EDIT PROJECT OPTIONS... // 1 VERSIONINFO -FILEVERSION 0,0,20,0 -PRODUCTVERSION 0,0,20,0 +FILEVERSION 0,0,21,0 +PRODUCTVERSION 0,0,21,0 FILETYPE VFT_APP { BLOCK "StringFileInfo" @@ -16,14 +16,14 @@ FILETYPE VFT_APP BLOCK "040904E4" { VALUE "CompanyName", "The Mana World Development Team" - VALUE "FileVersion", "0.0.20" + VALUE "FileVersion", "0.0.21" VALUE "FileDescription", "The Mana World" VALUE "InternalName", "tmw.exe" VALUE "LegalCopyright", "2004-2006 (C)" VALUE "LegalTrademarks", "" VALUE "OriginalFilename", "tmw.exe" VALUE "ProductName", "The Mana World MMORPG" - VALUE "ProductVersion", "0.0.20" + VALUE "ProductVersion", "0.0.21" } } BLOCK "VarFileInfo" diff --git a/tools/Reorganize.java b/tools/Reorganize.java index 19a17b99..22f42604 100644 --- a/tools/Reorganize.java +++ b/tools/Reorganize.java @@ -12,7 +12,7 @@ import java.io.File; import javax.imageio.ImageIO; /** - * Very simple tool to reorganize the monster spritesets. + * Tool to reorganize the hair spritesets. */ public class Reorganize { @@ -20,6 +20,12 @@ public class Reorganize private static final int SPRITE_HEIGHT = 60; private static final int FRAMES = 10; private static final int DIRECTIONS = 4; + + private static final int HAIR_COLORS = 10; + private static final int HAIR_FRAMES = 9; + private static final int HAIR_SPRITE_WIDTH = 40; + private static final int HAIR_SPRITE_HEIGHT = 40; + private static final int TRANSPARENT = new Color(255, 0, 255).getRGB(); public static void main(String[] arg) @@ -38,30 +44,15 @@ public class Reorganize System.exit(1); } - Rectangle cropRect = null; - - // Read the existing frames into a vector and determine minimal - // rectangle that still can contain the contents of any frame. - Vector spriteSet = new Vector(); - for (int x = 0; x < DIRECTIONS; x++) { - for (int y = 0; y < FRAMES; y++) { - BufferedImage sprite = source.getSubimage( - x * SPRITE_WIDTH, - y * SPRITE_HEIGHT, - SPRITE_WIDTH, - SPRITE_HEIGHT); - - spriteSet.add(sprite); + // Read the existing frames into a vector + Vector spriteSet = gridCut(source, + HAIR_SPRITE_WIDTH, HAIR_SPRITE_HEIGHT, + HAIR_FRAMES, HAIR_COLORS); - Rectangle frameCropRect = determineCropRect(sprite); - - if (cropRect == null) { - cropRect = frameCropRect; - } else { - cropRect.add(frameCropRect); - } - } - } + // Determine minimal rectangle that can still contain the contents of + // any frame + /* + Rectangle cropRect = minimumCropRect(spriteSet); if (cropRect == null) { System.out.println( @@ -76,19 +67,61 @@ public class Reorganize System.out.println(arg[0] + ": width=\"" + cropRect.width + "\" height=\"" + cropRect.height + "\""); + */ + + filterHairstyle(spriteSet); + + BufferedImage target = gridDraw( + spriteSet, + new Rectangle(0, 0, HAIR_SPRITE_WIDTH, HAIR_SPRITE_HEIGHT), + HAIR_FRAMES - 4, HAIR_COLORS); - // Create a new image (with frame direction flipped) + // Save the target image + try { + ImageIO.write(target, "png", new File(arg[1])); + } catch (IOException e) { + System.out.println("Error while trying to write " + arg[1] + "."); + e.printStackTrace(); + System.exit(1); + } + } + + private static Vector gridCut( + BufferedImage source, + int width, int height, int xFrames, int yFrames) + { + Vector spriteSet = new Vector(); + + for (int y = 0; y < yFrames; y++) { + for (int x = 0; x < xFrames; x++) { + BufferedImage sprite = source.getSubimage( + x * width, + y * height, + width, + height); + + spriteSet.add(sprite); + } + } + + return spriteSet; + } + + private static BufferedImage gridDraw(Vector spriteSet, + Rectangle cropRect, int xFrames, int yFrames) + { + // Create a new image BufferedImage target = new BufferedImage( - FRAMES * cropRect.width, - DIRECTIONS * cropRect.height, + xFrames * cropRect.width, + yFrames * cropRect.height, BufferedImage.TYPE_INT_ARGB); // Draw the frames onto the target image Graphics g = target.getGraphics(); - for (int y = 0; y < DIRECTIONS; y++) { - for (int x = 0; x < FRAMES; x++) { + for (int y = 0; y < yFrames; y++) { + for (int x = 0; x < xFrames; x++) { g.drawImage( - spriteSet.get(x + FRAMES * y).getSubimage( + spriteSet.get(x + xFrames * y).getSubimage( cropRect.x, cropRect.y, cropRect.width, @@ -99,14 +132,24 @@ public class Reorganize } } - // Save the target image - try { - ImageIO.write(target, "png", new File(arg[1])); - } catch (IOException e) { - System.out.println("Error while trying to write " + arg[1] + "."); - e.printStackTrace(); - System.exit(1); + return target; + } + + private static Rectangle minimumCropRect(Vector spriteSet) + { + Rectangle cropRect = null; + + for (BufferedImage sprite : spriteSet) { + Rectangle frameCropRect = determineCropRect(sprite); + + if (cropRect == null) { + cropRect = frameCropRect; + } else { + cropRect.add(frameCropRect); + } } + + return cropRect; } private static Rectangle determineCropRect(BufferedImage image) @@ -130,4 +173,15 @@ public class Reorganize return rect; } + + private static void filterHairstyle(Vector spriteSet) + { + // Remove frame 1, 2, 6 and 7 from each color + for (int i = HAIR_COLORS - 1; i >= 0; i--) { + spriteSet.remove(i * HAIR_FRAMES + 7); + spriteSet.remove(i * HAIR_FRAMES + 6); + spriteSet.remove(i * HAIR_FRAMES + 2); + spriteSet.remove(i * HAIR_FRAMES + 1); + } + } } -- cgit v1.2.3-70-g09d2 From 6374ef220d8f46647190074338f868b5d6bb4a45 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 5 Nov 2006 15:22:13 +0000 Subject: Merged 0.0 changes from revision 2800 to 2825 to trunk. --- ChangeLog | 79 ++++++++++-- data/graphics/images/CMakeLists.txt | 3 +- data/graphics/images/Makefile.am | 3 +- data/graphics/images/login_wallpaper.png | Bin 205907 -> 215527 bytes src/CMakeLists.txt | 2 + src/Makefile.am | 2 + src/being.cpp | 12 ++ src/being.h | 2 +- src/gui/buy.cpp | 36 +++--- src/gui/buy.h | 3 +- src/gui/sell.cpp | 56 +++++---- src/gui/sell.h | 10 +- src/gui/shop.cpp | 44 ++++++- src/gui/shop.h | 37 +++++- src/gui/shoplistbox.cpp | 200 +++++++++++++++++++++++++++++++ src/gui/shoplistbox.h | 124 +++++++++++++++++++ src/gui/updatewindow.cpp | 3 +- src/main.cpp | 2 +- src/net/buysellhandler.cpp | 1 + src/player.cpp | 38 +++++- src/player.h | 3 + src/resources/resourcemanager.cpp | 8 +- 22 files changed, 595 insertions(+), 73 deletions(-) create mode 100644 src/gui/shoplistbox.cpp create mode 100644 src/gui/shoplistbox.h (limited to 'src/gui/buy.h') diff --git a/ChangeLog b/ChangeLog index 45b92cbd..663c53b1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,41 @@ +2006-11-05 Bjørn Lindeijer + + * data/graphics/images/login_wallpaper.png: Reverted to standard + wallpaper. + * src/resources/resourcemanager.cpp: More useful logging about + resources that are being loaded (including source). + +2006-11-05 Yohann Ferreira + + * src/Makefile.am, src/gui/buy.cpp, src/gui/buy.h, src/gui/shop.h, + src/gui/shop.cpp, src/gui/sell.cpp, src/gui/shoplistbox.h, + src/gui/shoplistbox.cpp: Added pictures to items in buy dialogs. + Also too expensive items are highlighted in gray and can't be + selected. + * src/gui/shop.cpp, src/gui/shop.h, src/gui.sell.h, src/gui/sell.cpp, + src/net/buysellhandler.cpp, src/gui/shoplistbox.h, + src/gui/shoplistbox.cpp: Added item's pictures in sell dialogs, and + precisions about the total money in it. + * src/gui/shop.h, src/gui/shop.cpp, src/gui/sell.cpp: Fixes to Sell + dialog. + +2006-11-05 Björn Steinbrink + + * data/graphics/sprites/Makefile.am: Use tabs instead of spaces as + required by automake (AFAIK). + +2006-11-05 Philipp Sehmisch + + * data/graphics/sprites/weapon0.png, + data/graphics/sprites/weapon2.png, + data/graphics/sprites/weapon-bow.xml, + data/graphics/sprites/weapon-dagger.xml, + data/graphics/sprites/weapon-fist.xml, + data/graphics/sprites/weapon-scythe.xml, + data/graphics/items/weapon-polearm-scythe.png, src/player.cpp, + src/player.h, src/being.cpp, src/being.h, data/items.xml: Added scythe + as a permanent weapon (ID: 623) + 2006-11-04 Björn Steinbrink * src/main.cpp: Use \n instead of std::endl when writing to stdout. @@ -9,6 +47,31 @@ instead of /dev/null to quieten libxml2. Actually initialize libxml2 before using it to load the configuration. +2006-11-04 Bjørn Lindeijer + + * data/maps/new_1-1.tmx.gz, data/maps/new_10-1.tmx.gz, + data/maps/new_11-1.tmx.gz, data/maps/new_14-1.tmx.gz, + data/maps/new_15-1.tmx.gz, data/maps/new_16-1.tmx.gz, + data/maps/new_3-1.tmx.gz, data/maps/new_7-1.tmx.gz, + data/maps/new_9-1.tmx.gz: Reverted Halloween map versions, except for + map 10 and 11 which include the latest fixes by Crush but now have + their night layer removed. + +2006-11-04 Philipp Sehmisch + + * data/maps/new_17-1.tmx.gz, + data/graphics/images/minimap_new_17-1.png, + data/graphics/images/Makefile.am, + data/graphics/images/CMakeLists.txt: + Added music and minimap to woodland cave level 2. + * data/maps/new_10-1.tmx.gz, maps/new_11-1.tmx.gz: + Fixed some map bugs (please update server sided walkmap) + +2006-11-03 Bjørn Lindeijer + + * src/gui/updatewindow.cpp, src/main.cpp: Updated to the new default + updatehost. + 2006-11-02 Björn Steinbrink * src/gui/register.cpp, src/gui/register.h: Fixed a memory leak and a @@ -59,17 +122,15 @@ 2006-10-31 Philipp Sehmisch - *data/graphics/tiles/desert1.png, d - ata/graphics/tiles/desert_x2.png: adding a bunch of graphical - improvements made by VxD. + * data/graphics/tiles/desert1.png, data/graphics/tiles/desert_x2.png: + Adding a bunch of graphical improvements made by VxD. 2006-10-31 Frode Lindeijer - * /data/graphics/sprites/item011.png, - /data/graphics/sprites/item011.xml, - /data/graphics/sprites/item012.png, - /data/graphics/sprites/item018.xml, - /data/graphics/sprites/monster21.xml: Fixed some graphical issues, + * data/graphics/sprites/item011.png, + data/graphics/sprites/item011.xml, data/graphics/sprites/item012.png, + data/graphics/sprites/item018.xml, + data/graphics/sprites/monster21.xml: Fixed some graphical issues, mostly a cosmetic update. 2006-10-30 Yohann Ferreira @@ -78,7 +139,7 @@ 2006-10-30 Philipp Sehmisch - * data/maps/new_9-1.tmx.gz: Removed the night effect that accidently + * data/maps/new_9-1.tmx.gz: Removed the night effect that accidentally sneaked in with the last map change. 2006-10-30 Eugenio Favalli diff --git a/data/graphics/images/CMakeLists.txt b/data/graphics/images/CMakeLists.txt index 471d4c92..53f8b3a7 100644 --- a/data/graphics/images/CMakeLists.txt +++ b/data/graphics/images/CMakeLists.txt @@ -11,6 +11,7 @@ SET(FILES minimap_new_5-1.png minimap_new_7-1.png minimap_new_9-1.png + minimap_new_17-1.png ) -INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/graphics/images) +INSTALL(FILES ${FILES} DESTINATION ${DATA_DIR}/graphics/images) \ No newline at end of file diff --git a/data/graphics/images/Makefile.am b/data/graphics/images/Makefile.am index fb54cb95..cc71b18a 100644 --- a/data/graphics/images/Makefile.am +++ b/data/graphics/images/Makefile.am @@ -12,7 +12,8 @@ images_DATA = \ minimap_new_9-1.png \ minimap_new_14-1.png \ minimap_new_15-1.png \ - minimap_new_16-1.png + minimap_new_16-1.png \ + minimap_new_17-1.png EXTRA_DIST = \ $(images_DATA) \ No newline at end of file diff --git a/data/graphics/images/login_wallpaper.png b/data/graphics/images/login_wallpaper.png index 258bad22..54692dfd 100644 Binary files a/data/graphics/images/login_wallpaper.png and b/data/graphics/images/login_wallpaper.png differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6a46aba4..8523b066 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -134,6 +134,8 @@ SET(SRCS gui/setup_video.h gui/shop.cpp gui/shop.h + gui/shoplistbox.cpp + gui/shoplistbox.h gui/skill.cpp gui/skill.h gui/slider.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 8ab16e32..5c8d77a0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -95,6 +95,8 @@ tmw_SOURCES = graphic/imagerect.h \ gui/setup_video.h \ gui/shop.cpp \ gui/shop.h \ + gui/shoplistbox.cpp \ + gui/shoplistbox.h \ gui/skill.cpp \ gui/skill.h \ gui/slider.cpp \ diff --git a/src/being.cpp b/src/being.cpp index fa24ad69..50a2dc35 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -321,6 +321,9 @@ Being::setAction(Uint8 action) else { switch (getWeapon()) { + case 3: + currentAction = ACTION_ATTACK; + break; case 2: currentAction = ACTION_ATTACK_BOW; break; @@ -565,12 +568,17 @@ Being::getType() const void Being::setWeaponById(Uint16 weapon) { + //TODO: Use an external file to map weapon IDs to weapon types switch (weapon) { case 529: // iron arrows case 1199: // arrows break; + case 623: //scythe + setWeapon(3); + break; + case 1200: // bow case 530: // short bow case 545: // forest bow @@ -578,6 +586,10 @@ Being::setWeaponById(Uint16 weapon) break; case 521: // sharp knife + /* UNCOMMENT TO TEST SHARP KNIFE AS SCYTHE + * setWeapon(3) + * break; + */ case 522: // dagger case 536: // short sword case 1201: // knife diff --git a/src/being.h b/src/being.h index d8db9375..2804b20b 100644 --- a/src/being.h +++ b/src/being.h @@ -258,7 +258,7 @@ class Being : public Sprite * * @param weapon the picture id */ - void + virtual void setWeapon(Uint16 weapon) { mWeapon = weapon; } /** diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 73f696b7..b681b683 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -26,14 +26,12 @@ #include #include "button.h" -#include "listbox.h" #include "scrollarea.h" #include "shop.h" #include "slider.h" #include "../npc.h" -#include "../resources/iteminfo.h" #include "../resources/itemmanager.h" #include "../utils/tostring.h" @@ -45,8 +43,8 @@ BuyDialog::BuyDialog(): { mShopItems = new ShopItems; - mItemList = new ListBox(mShopItems); - mScrollArea = new ScrollArea(mItemList); + mShopItemList = new ShopListBox(mShopItems, mShopItems); + mScrollArea = new ScrollArea(mShopItemList); mSlider = new Slider(1.0); mQuantityLabel = new gcn::Label("0"); mMoneyLabel = new gcn::Label("Price : 0 GP / 0 GP"); @@ -60,7 +58,7 @@ BuyDialog::BuyDialog(): setContentSize(260, 210); mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); mScrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110)); - mItemList->setDimension(gcn::Rectangle(5, 5, 238, 110)); + mShopItemList->setDimension(gcn::Rectangle(5, 5, 238, 110)); mSlider->setDimension(gcn::Rectangle(5, 120, 200, 10)); mSlider->setEnabled(false); @@ -84,11 +82,11 @@ BuyDialog::BuyDialog(): mItemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14)); mItemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14)); - mItemList->setEventId("item"); + mShopItemList->setEventId("item"); mSlider->setEventId("slider"); - mItemList->addActionListener(this); - mItemList->addSelectionListener(this); + mShopItemList->addActionListener(this); + mShopItemList->addSelectionListener(this); mSlider->addActionListener(this); add(mScrollArea); @@ -113,6 +111,7 @@ BuyDialog::~BuyDialog() void BuyDialog::setMoney(int amount) { mMoney = amount; + mShopItemList->setPlayersMoney(amount); mMoneyLabel->setCaption("Price : 0 GP / " + toString(mMoney) + " GP"); mMoneyLabel->adjustSize(); } @@ -125,7 +124,7 @@ void BuyDialog::reset() mAmountItems = 0; // Reset Previous Selected Items to prevent failing asserts - mItemList->setSelected(-1); + mShopItemList->setSelected(-1); mIncreaseButton->setEnabled(false); mDecreaseButton->setEnabled(false); mQuantityLabel->setCaption("0"); @@ -138,20 +137,13 @@ void BuyDialog::reset() void BuyDialog::addItem(short id, int price) { - ITEM_SHOP item_shop; - - item_shop.name = itemDb->getItemInfo(id).getName() + " " - + toString(price) + " GP"; - item_shop.price = price; - item_shop.id = id; - - mShopItems->push_back(item_shop); - mItemList->adjustSize(); + mShopItems->addItem(id, price); + mShopItemList->adjustSize(); } void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) { - int selectedItem = mItemList->getSelected(); + int selectedItem = mShopItemList->getSelected(); if (eventId == "item") { @@ -169,7 +161,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) // If no item was selected, none can be bought, otherwise // calculate how many the player can afford - mMaxItems = (mItemList->getSelected() == -1) ? 0 : + mMaxItems = (mShopItemList->getSelected() == -1) ? 0 : mMoney / mShopItems->at(selectedItem).price; // When at least one item can be bought, enable the slider and the @@ -184,7 +176,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) } // The following actions require a valid selection - if (selectedItem < 0 || selectedItem >= int(mShopItems->size())) + if (selectedItem < 0 || selectedItem >= int(mShopItems->getNumberOfElements())) { return; } @@ -269,7 +261,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) void BuyDialog::selectionChanged(const SelectionEvent &event) { - int selectedItem = mItemList->getSelected(); + int selectedItem = mShopItemList->getSelected(); if (selectedItem > -1) { diff --git a/src/gui/buy.h b/src/gui/buy.h index f5c163e1..b83b6f2f 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -28,6 +28,7 @@ #include "window.h" #include "selectionlistener.h" +#include "shoplistbox.h" #include "../guichanfwd.h" @@ -96,7 +97,7 @@ class BuyDialog : public Window, public gcn::ActionListener, SelectionListener gcn::Button *mQuitButton; gcn::Button *mIncreaseButton; gcn::Button *mDecreaseButton; - ListBox *mItemList; + ShopListBox *mShopItemList; gcn::ScrollArea *mScrollArea; gcn::Label *mItemDescLabel; gcn::Label *mItemEffectLabel; diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 9c25aced..fd63633c 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -28,7 +28,7 @@ #include #include "button.h" -#include "listbox.h" +#include "shoplistbox.h" #include "scrollarea.h" #include "shop.h" #include "slider.h" @@ -47,11 +47,11 @@ SellDialog::SellDialog(): { mShopItems = new ShopItems(); - mItemList = new ListBox(mShopItems); - ScrollArea *scrollArea = new ScrollArea(mItemList); + mShopItemList = new ShopListBox(mShopItems, mShopItems); + ScrollArea *scrollArea = new ScrollArea(mShopItemList); mSlider = new Slider(1.0); mQuantityLabel = new gcn::Label("0"); - mMoneyLabel = new gcn::Label("Price: 0"); + mMoneyLabel = new gcn::Label("Money: 0 GP / Total: 0 GP"); mItemDescLabel = new gcn::Label("Description:"); mItemEffectLabel = new gcn::Label("Effect:"); mIncreaseButton = new Button("+", "+", this); @@ -63,7 +63,7 @@ SellDialog::SellDialog(): setContentSize(260, 210); scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110)); - mItemList->setDimension(gcn::Rectangle(5, 5, 238, 110)); + mShopItemList->setDimension(gcn::Rectangle(5, 5, 238, 110)); mSlider->setDimension(gcn::Rectangle(5, 120, 200, 10)); mSlider->setEnabled(false); @@ -87,11 +87,13 @@ SellDialog::SellDialog(): quitButton->setPosition(208, 186); - mItemList->setEventId("item"); + mShopItemList->setEventId("item"); mSlider->setEventId("mSlider"); - mItemList->addActionListener(this); - mItemList->addSelectionListener(this); + mShopItemList->setPriceCheck(false); + + mShopItemList->addActionListener(this); + mShopItemList->addSelectionListener(this); mSlider->addActionListener(this); add(scrollArea); @@ -121,13 +123,14 @@ void SellDialog::reset() mQuantityLabel->setCaption("0"); mQuantityLabel->adjustSize(); - mMoneyLabel->setCaption("Price: 0"); + mMoneyLabel->setCaption("Money: 0 GP / Total: " + + toString(mPlayerMoney) + " GP"); mMoneyLabel->adjustSize(); mItemDescLabel->setCaption(""); mItemEffectLabel->setCaption(""); // Reset Previous Selected Items to prevent failing asserts - mItemList->setSelected(-1); + mShopItemList->setSelected(-1); mIncreaseButton->setEnabled(false); mDecreaseButton->setEnabled(false); } @@ -144,14 +147,15 @@ void SellDialog::addItem(Item *item, int price) item_shop.index = item->getInvIndex(); item_shop.id = item->getId(); item_shop.quantity = item->getQuantity(); + item_shop.image = item->getInfo().getImage(); mShopItems->push_back(item_shop); - mItemList->adjustSize(); + mShopItemList->adjustSize(); } void SellDialog::action(const std::string &eventId, gcn::Widget *widget) { - int selectedItem = mItemList->getSelected(); + int selectedItem = mShopItemList->getSelected(); if (eventId == "item") { @@ -160,19 +164,22 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) mDecreaseButton->setEnabled(false); mSellButton->setEnabled(false); - mQuantityLabel->setCaption("0"); mQuantityLabel->adjustSize(); - mMoneyLabel->setCaption("Price: 0"); + mMoneyLabel->setCaption("Money: 0 GP / Total: " + + toString(mPlayerMoney) + " GP"); mMoneyLabel->adjustSize(); if (selectedItem > -1) { mSlider->setEnabled(true); mIncreaseButton->setEnabled(true); mMaxItems = mShopItems->at(selectedItem).quantity; + mQuantityLabel->setCaption("0 / " + toString(mMaxItems)); } else { mSlider->setEnabled(false); mIncreaseButton->setEnabled(false); + mQuantityLabel->setCaption("0"); } + mQuantityLabel->adjustSize(); } else if (eventId == "quit") { @@ -181,7 +188,7 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) } // The following actions require a valid item selection - if (selectedItem == -1 || selectedItem >= int(mShopItems->size())) { + if (selectedItem == -1 || selectedItem >= int(mShopItems->getNumberOfElements())) { return; } @@ -224,14 +231,16 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) */ mMaxItems -= mAmountItems; + mShopItems->getShop()->at(selectedItem).quantity = mMaxItems; mAmountItems = 0; mSlider->setValue(0); mSlider->setEnabled(mMaxItems != 0); // All were sold if (!mMaxItems) { - mItemList->setSelected(-1); - mShopItems->erase(mShopItems->begin() + selectedItem); + + mShopItemList->setSelected(-1); + mShopItems->getShop()->erase(mShopItems->getShop()->begin() + selectedItem); } // Update only when there are items left, the entry doesn't exist @@ -243,11 +252,12 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) if (updateButtonsAndLabels) { // Update labels - mQuantityLabel->setCaption(toString(mAmountItems)); + mQuantityLabel->setCaption(toString(mAmountItems) + " / " + toString(mMaxItems)); mQuantityLabel->adjustSize(); int price = mAmountItems * mShopItems->at(selectedItem).price; - mMoneyLabel->setCaption("Price: " + toString(price)); + mMoneyLabel->setCaption("Money: " + toString(price) + " GP / Total: " + + toString(price + mPlayerMoney) + " GP"); mMoneyLabel->adjustSize(); // Update Buttons @@ -259,7 +269,7 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) void SellDialog::selectionChanged(const SelectionEvent &event) { - int selectedItem = mItemList->getSelected(); + int selectedItem = mShopItemList->getSelected(); if (selectedItem > -1) { @@ -275,3 +285,9 @@ void SellDialog::selectionChanged(const SelectionEvent &event) mItemEffectLabel->setCaption("Effect"); } } + +void SellDialog::setMoney(int amount) +{ + mPlayerMoney = amount; + mShopItemList->setPlayersMoney(amount); +} diff --git a/src/gui/sell.h b/src/gui/sell.h index 69f8b089..ba324576 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -33,7 +33,7 @@ class Item; class ShopItems; -class ListBox; +class ShopListBox; /** * The sell dialog. @@ -77,11 +77,16 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener */ void selectionChanged(const SelectionEvent &event); + /** + * Gives Player's Money amount + */ + void setMoney(int amount); + private: gcn::Button *mSellButton; gcn::Button *mIncreaseButton; gcn::Button *mDecreaseButton; - ListBox *mItemList; + ShopListBox *mShopItemList; gcn::Label *mMoneyLabel; gcn::Label *mItemDescLabel; gcn::Label *mItemEffectLabel; @@ -89,6 +94,7 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener gcn::Slider *mSlider; ShopItems *mShopItems; + int mPlayerMoney; int mMaxItems; int mAmountItems; diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 3706cdf8..3f30732a 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -22,13 +22,53 @@ */ #include "shop.h" +#include "../utils/tostring.h" +#include "../resources/itemmanager.h" + +ShopItems::~ShopItems() +{ + clear(); +} int ShopItems::getNumberOfElements() { - return size(); + return mItemsShop.size(); } std::string ShopItems::getElementAt(int i) { - return at(i).name; + return mItemsShop.at(i).name; +} + +void ShopItems::addItem(short id, int price) +{ + ITEM_SHOP item_shop; + + item_shop.name = itemDb->getItemInfo(id).getName() + + " " + toString(price) + " GP"; + item_shop.price = price; + item_shop.id = id; + item_shop.image = itemDb->getItemInfo(id).getImage(); + + mItemsShop.push_back(item_shop); +} + +ITEM_SHOP ShopItems::at(int i) +{ + return mItemsShop.at(i); +} + +void ShopItems::push_back(ITEM_SHOP item_shop) +{ + mItemsShop.push_back(item_shop); +} + +void ShopItems::clear() +{ + mItemsShop.clear(); +} + +std::vector* ShopItems::getShop() +{ + return &mItemsShop; } diff --git a/src/gui/shop.h b/src/gui/shop.h index fb1f33fd..de452b5c 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -28,22 +28,34 @@ #include #include +#include "../resources/image.h" struct ITEM_SHOP { + short id; std::string name; + Image *image; int price; - short id; int index; int quantity; }; -class ShopItems : public std::vector, public gcn::ListModel +class ShopItems : public gcn::ListModel { public: /** * Destructor */ - virtual ~ShopItems() {}; + ~ShopItems(); + + /** + * Adds an item and its associated picture + */ + void addItem(short id, int price); + + /** + * Convenience function for adding items + */ + void push_back(ITEM_SHOP item_shop); /** * Returns the number of items in the shop. @@ -54,6 +66,25 @@ class ShopItems : public std::vector, public gcn::ListModel * Returns the name of item number i in the shop. */ std::string getElementAt(int i); + + /** + * Returns the item number i in the shop. + */ + ITEM_SHOP at(int i); + + /** + * Clear the vector. + */ + void clear(); + + /** + * Direct access to the vector + */ + std::vector* getShop(); + + private: + std::vector mItemsShop; + }; #endif diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp new file mode 100644 index 00000000..61abff35 --- /dev/null +++ b/src/gui/shoplistbox.cpp @@ -0,0 +1,200 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id: listbox.cpp 2655 2006-09-03 21:25:02Z b_lindeijer $ + */ + +#include "shoplistbox.h" + +#include "selectionlistener.h" + +#include +#include +#include +#include +#include +#include + +#include "../graphics.h" + +const int ITEM_SPRITE_HEIGHT = 32; + +ShopListBox::ShopListBox(gcn::ListModel *listModel): + gcn::ListBox(listModel), + mMousePressed(false), + mPlayerMoney(0) +{ + mRowHeight = getFont()->getHeight(); + mPriceCheck = true; +} + +ShopListBox::ShopListBox(gcn::ListModel *listModel, ShopItems *shopListModel): + gcn::ListBox(listModel), + mMousePressed(false), + mPlayerMoney(0), + mShopItems(shopListModel) +{ + mRowHeight = (getFont()->getHeight() > ITEM_SPRITE_HEIGHT ? + getFont()->getHeight() : ITEM_SPRITE_HEIGHT); + mPriceCheck = true; +} + + +void ShopListBox::setPlayersMoney(int money) +{ + mPlayerMoney = money; +} + +void ShopListBox::draw(gcn::Graphics *graphics) +{ + if (mListModel == NULL) { + return; + } + + graphics->setFont(getFont()); + + // Draw the list elements + for (int i = 0, y = 0; i < mListModel->getNumberOfElements(); ++i, y += mRowHeight) + { + graphics->setColor(gcn::Color(0xffffff)); + if (mShopItems != NULL) + { + if(mPlayerMoney < mShopItems->at(i).price && mPriceCheck) + { + graphics->setColor(gcn::Color(0x919191)); + } + } + graphics->fillRectangle(gcn::Rectangle(0, y, getWidth(), mRowHeight)); + if (mShopItems) + dynamic_cast(graphics)->drawImage(mShopItems->at(i).image, 1, y); + graphics->drawText(mListModel->getElementAt(i), ITEM_SPRITE_HEIGHT, y); + } + + // Draw rectangle below the selected list element and the list element + // not shown. + if (mSelected >= 0) { + graphics->setColor(gcn::Color(110, 160, 255)); + graphics->fillRectangle(gcn::Rectangle(0, mRowHeight * mSelected, + getWidth(), mRowHeight)); + if (mShopItems) + dynamic_cast(graphics)->drawImage( + mShopItems->at(mSelected).image, 1, mRowHeight * mSelected); + graphics->drawText(mListModel->getElementAt(mSelected), + ITEM_SPRITE_HEIGHT, mRowHeight * mSelected); + } +} + +void ShopListBox::setSelected(int selected) +{ + gcn::ListBox::setSelected(selected); + if (mListModel != NULL) + { + gcn::BasicContainer *par = getParent(); + if (par == NULL) + { + return; + } + + gcn::Rectangle scroll; + + if (mSelected < 0) + { + scroll.y = 0; + } + else + { + scroll.y = mRowHeight * mSelected; + } + + scroll.height = mRowHeight; + par->showWidgetPart(this, scroll); + } + fireSelectionChangedEvent(); +} + +void ShopListBox::mousePress(int x, int y, int button) +{ + + bool enoughMoney = false; + if (button == gcn::MouseInput::LEFT && hasMouse()) + { + if (mShopItems) + { + if(mPlayerMoney >= mShopItems->at(y / mRowHeight).price) + enoughMoney = true; + } + else // Old Behaviour + enoughMoney = true; + + if (!mPriceCheck) + enoughMoney = true; + + if (enoughMoney) + { + setSelected(y / mRowHeight); + generateAction(); + mMousePressed = true; + } + } +} + +void ShopListBox::mouseRelease(int x, int y, int button) +{ + gcn::ListBox::mouseRelease(x, y, button); + + mMousePressed = false; +} + +void ShopListBox::mouseMotion(int x, int y) +{ + gcn::ListBox::mouseMotion(x, y); + + // Pretend mouse is pressed continuously while dragged. Causes list + // selection to be updated as is default in many GUIs. + if (mMousePressed) + { + mousePress(x, y, gcn::MouseInput::LEFT); + } +} + +void ShopListBox::fireSelectionChangedEvent() +{ + SelectionEvent event(this); + SelectionListeners::iterator i_end = mListeners.end(); + SelectionListeners::iterator i; + + for (i = mListeners.begin(); i != i_end; ++i) + { + (*i)->selectionChanged(event); + } +} + +void ShopListBox::adjustSize() +{ + if (mListModel != NULL) + { + setHeight(mRowHeight * mListModel->getNumberOfElements()); + } +} + +void ShopListBox::setPriceCheck(bool check) +{ + mPriceCheck = check; +} diff --git a/src/gui/shoplistbox.h b/src/gui/shoplistbox.h new file mode 100644 index 00000000..2dff8977 --- /dev/null +++ b/src/gui/shoplistbox.h @@ -0,0 +1,124 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id: listbox.h 2655 2006-09-03 21:25:02Z b_lindeijer $ + */ + +#ifndef _TMW_LISTBOX_H +#define _TMW_LISTBOX_H + +#include +#include "shop.h" + +class SelectionListener; + +/** + * A list box, meant to be used inside a scroll area. Same as the Guichan list + * box except this one doesn't have a background, instead completely relying + * on the scroll area. It also adds selection listener functionality. + * + * \ingroup GUI + */ +class ShopListBox : public gcn::ListBox +{ + public: + /** + * Constructor. + */ + ShopListBox(gcn::ListModel *listModel); + + /** + * Constructor with shopitems + */ + ShopListBox(gcn::ListModel *listModel, ShopItems *shopListModel); + + /** + * Draws the list box. + */ + void draw(gcn::Graphics *graphics); + + void mousePress(int x, int y, int button); + void mouseRelease(int x, int y, int button); + void mouseMotion(int x, int y); + + /** + * Adds a listener to the list that's notified each time a change to + * the selection occurs. + */ + void addSelectionListener(SelectionListener *listener) + { + mListeners.push_back(listener); + } + + /** + * Removes a listener from the list that's notified each time a change + * to the selection occurs. + */ + void removeSelectionListener(SelectionListener *listener) + { + mListeners.remove(listener); + } + + /** + * Sets the index of the selected element. + */ + void setSelected(int selected); + + /** + * gives information about the current player's money + */ + void setPlayersMoney(int money); + + /** + * Adjust List draw size + */ + void adjustSize(); + + /** + * Set on/off the disabling of too expensive items. + * (Good for selling mode.) + */ + void setPriceCheck(bool check); + + private: + /** + * Sends out selection events to the list of selection listeners. + */ + void fireSelectionChangedEvent(); + + bool mMousePressed; /**< Keeps track of mouse pressed status. */ + + std::list mListeners; + + int mPlayerMoney; + + /** + * Keeps another pointer to the same listModel, permitting to + * use the ShopItems specific functions. + */ + ShopItems *mShopItems; + + int mRowHeight; /**< Row Height */ + + bool mPriceCheck; + +}; + +#endif diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 510e10ba..c29906a1 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -86,7 +86,8 @@ UpdaterWindow::UpdaterWindow(): mCancelButton->requestFocus(); setLocationRelativeTo(getParent()); - mUpdateHost = config.getValue("updatehost", "themanaworld.org/files"); + mUpdateHost = + config.getValue("updatehost", "http://updates.themanaworld.org"); mBasePath = config.getValue("homeDir", "."); // Try to download the updates list diff --git a/src/main.cpp b/src/main.cpp index c1919bc0..59bb1566 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -186,7 +186,7 @@ void initConfiguration(const Options &options) config.setValue("sfxVolume", 100); config.setValue("musicVolume", 60); config.setValue("fpslimit", 0); - config.setValue("updatehost", "http://themanaworld.org/files"); + config.setValue("updatehost", "http://updates.themanaworld.org"); config.setValue("customcursor", 1); config.setValue("homeDir", homeDir); diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp index 173c59d2..473a706c 100644 --- a/src/net/buysellhandler.cpp +++ b/src/net/buysellhandler.cpp @@ -89,6 +89,7 @@ void BuySellHandler::handleMessage(MessageIn &msg) msg.readShort(); // length n_items = (msg.getLength() - 4) / 10; if (n_items > 0) { + sellDialog->setMoney(player_node->mMoney); sellDialog->reset(); sellDialog->setVisible(true); diff --git a/src/player.cpp b/src/player.cpp index 12f5f3d5..0acf8262 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -35,11 +35,10 @@ Player::Player(Uint16 id, Uint16 job, Map *map): Being(id, job, map) { - /* Load the weapon sprite. When there are more different weapons this - * should be moved to the setWeapon Method. - */ - mSprites[WEAPON_SPRITE] = - new AnimatedSprite("graphics/sprites/weapons.xml", 0); + // Load the weapon sprite. + // When there are more different weapons this should be moved to the + // setWeapon Method. + setWeapon(0); } Being::Type @@ -88,6 +87,35 @@ Player::setSex(Uint8 sex) } } + +void +Player::setWeapon(Uint16 weapon) +{ + if (weapon != mWeapon) + { + delete mSprites[WEAPON_SPRITE]; + mSprites[WEAPON_SPRITE] = NULL; + + switch (weapon) + { + case 0: + mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-fist.xml", 0); + break; + case 1: + mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-dagger.xml", 0); + break; + case 2: + mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-bow.xml", 0); + break; + case 3: + mSprites[WEAPON_SPRITE] = new AnimatedSprite("graphics/sprites/weapon-scythe.xml", 0); + break; + } + } + Being::setWeapon(weapon); +} + + void Player::setHairColor(Uint16 color) { diff --git a/src/player.h b/src/player.h index 6ff4babe..3c061be6 100644 --- a/src/player.h +++ b/src/player.h @@ -58,6 +58,9 @@ class Player : public Being virtual void setVisibleEquipment(Uint8 slot, Uint8 id); + virtual void + setWeapon(Uint16 weapon); + private: /** * Resets all animations associated with this player. This is used to diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 23a73497..bb51d023 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -122,13 +122,9 @@ ResourceManager::get(const E_RESOURCE_TYPE &type, const std::string &idPath) return resIter->second; } - logger->log("ResourceManager::get(%s)", idPath.c_str()); - int fileSize; void *buffer = loadFile(idPath, fileSize); - if (!buffer) { - logger->log("Warning: resource doesn't exist!"); return NULL; } @@ -265,6 +261,10 @@ ResourceManager::loadFile(const std::string &fileName, int &fileSize) return NULL; } + // Log the real dir of the file + logger->log("Loaded %s/%s", PHYSFS_getRealDir(fileName.c_str()), + fileName.c_str()); + // Get the size of the file fileSize = PHYSFS_fileLength(file); -- cgit v1.2.3-70-g09d2 From d1395845cdc678db2a71326f2e6f20253ed14cac Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 14 Jan 2007 16:45:13 +0000 Subject: Merged 0.0 changes from revision 2988 to 3035 to trunk. --- ChangeLog | 86 ++++++++++++++++++++++-- src/game.cpp | 19 +++--- src/gui/browserbox.cpp | 15 +++-- src/gui/browserbox.h | 10 +-- src/gui/buddywindow.cpp | 8 +-- src/gui/buddywindow.h | 2 +- src/gui/button.cpp | 9 +-- src/gui/button.h | 2 +- src/gui/buy.cpp | 16 ++--- src/gui/buy.h | 2 +- src/gui/buysell.cpp | 8 +-- src/gui/buysell.h | 2 +- src/gui/char_select.cpp | 40 +++++------ src/gui/char_select.h | 4 +- src/gui/chat.cpp | 15 +++-- src/gui/chat.h | 11 +-- src/gui/chatinput.cpp | 2 +- src/gui/chatinput.h | 2 +- src/gui/confirm_dialog.cpp | 7 +- src/gui/confirm_dialog.h | 2 +- src/gui/connection.cpp | 8 ++- src/gui/debugwindow.cpp | 16 +++-- src/gui/debugwindow.h | 2 +- src/gui/gccontainer.cpp | 6 +- src/gui/gccontainer.h | 9 ++- src/gui/help.cpp | 4 +- src/gui/help.h | 2 +- src/gui/inttextbox.cpp | 7 +- src/gui/inttextbox.h | 3 +- src/gui/inventorywindow.cpp | 20 +++--- src/gui/inventorywindow.h | 6 +- src/gui/item_amount.cpp | 20 +++--- src/gui/item_amount.h | 2 +- src/gui/itemcontainer.cpp | 35 ++++++---- src/gui/itemcontainer.h | 2 +- src/gui/listbox.cpp | 33 ++------- src/gui/listbox.h | 6 +- src/gui/login.cpp | 16 ++--- src/gui/login.h | 4 +- src/gui/menuwindow.cpp | 14 ++-- src/gui/newskill.cpp | 24 +++---- src/gui/newskill.h | 2 +- src/gui/npc_text.cpp | 4 +- src/gui/npc_text.h | 2 +- src/gui/npclistdialog.cpp | 8 +-- src/gui/npclistdialog.h | 2 +- src/gui/ok_dialog.cpp | 6 +- src/gui/ok_dialog.h | 2 +- src/gui/playerbox.cpp | 1 - src/gui/register.cpp | 6 +- src/gui/register.h | 2 +- src/gui/sell.cpp | 18 ++--- src/gui/sell.h | 2 +- src/gui/serverdialog.cpp | 23 ++++--- src/gui/serverdialog.h | 5 +- src/gui/setup.cpp | 8 +-- src/gui/setup.h | 2 +- src/gui/setup_audio.cpp | 10 +-- src/gui/setup_audio.h | 2 +- src/gui/setup_joystick.cpp | 5 +- src/gui/setup_joystick.h | 2 +- src/gui/setup_video.cpp | 49 +++++++------- src/gui/setup_video.h | 5 +- src/gui/shoplistbox.cpp | 6 +- src/gui/shoplistbox.h | 2 +- src/gui/skill.cpp | 10 +-- src/gui/skill.h | 2 +- src/gui/status.cpp | 4 +- src/gui/status.h | 2 +- src/gui/tabbedcontainer.cpp | 4 +- src/gui/tabbedcontainer.h | 2 +- src/gui/trade.cpp | 10 +-- src/gui/trade.h | 2 +- src/gui/updatewindow.cpp | 6 +- src/gui/updatewindow.h | 2 +- src/gui/viewport.cpp | 28 ++++---- src/gui/viewport.h | 28 ++++++-- src/gui/window.cpp | 121 +++++++++++---------------------- src/gui/window.h | 19 +++--- src/main.cpp | 10 +-- src/net/playerhandler.cpp | 4 +- src/net/tradehandler.cpp | 4 +- tools/Purger.java | 159 -------------------------------------------- 83 files changed, 495 insertions(+), 597 deletions(-) delete mode 100644 tools/Purger.java (limited to 'src/gui/buy.h') diff --git a/ChangeLog b/ChangeLog index 0cbbb214..d091a061 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,53 @@ +2007-01-14 Bjørn Lindeijer + + * src/game.cpp, src/main.cpp, src/gui/trade.cpp, src/gui/sell.cpp, + src/gui/connection.cpp, src/gui/buddywindow.cpp, src/gui/browserbox.h, + src/gui/char_server.cpp, src/gui/window.cpp, src/gui/login.cpp, + src/gui/inttextbox.h, src/gui/viewport.cpp, src/gui/button.h, + src/gui/shoplistbox.h, src/gui/skill.h, src/gui/item_amount.h, + src/gui/setup_audio.h, src/gui/newskill.cpp, src/gui/listbox.h, + src/gui/register.h, src/gui/setup.cpp, src/gui/npclistdialog.h, + src/gui/updatewindow.cpp, src/gui/button.cpp, src/gui/char_select.cpp, + src/gui/login.h, src/gui/setup_audio.cpp, src/gui/item_amount.cpp, + src/gui/setup_joystick.h, src/gui/chat.h, src/gui/npc_text.cpp, + src/gui/setup_video.cpp, src/gui/ok_dialog.cpp, + src/gui/inventorywindow.h, src/gui/gccontainer.cpp, + src/gui/newskill.h, src/gui/buy.h, src/gui/setup.h, + src/gui/itemcontainer.h, src/gui/confirm_dialog.cpp, + src/gui/debugwindow.cpp, src/gui/chat.cpp, src/gui/setup_joystick.cpp, + src/gui/updatewindow.h, src/gui/char_select.h, src/gui/buysell.h, + src/gui/tabbedcontainer.cpp, src/gui/inventorywindow.cpp, + src/gui/help.cpp, src/gui/status.h, src/gui/npc_text.h, + src/gui/setup_video.h, src/gui/menuwindow.cpp, src/gui/browserbox.cpp, + src/gui/ok_dialog.h, src/gui/buy.cpp, src/gui/itemcontainer.cpp, + src/gui/gccontainer.h, src/gui/buddywindow.h, src/gui/sell.h, + src/gui/trade.h, src/gui/inttextbox.cpp, src/gui/char_server.h, + src/gui/window.h, src/gui/shoplistbox.cpp, src/gui/skill.cpp, + src/gui/buysell.cpp, src/gui/confirm_dialog.h, src/gui/debugwindow.h, + src/gui/status.cpp, src/gui/listbox.cpp, src/gui/register.cpp, + src/gui/viewport.h, src/gui/tabbedcontainer.h, + src/gui/npclistdialog.cpp, src/gui/help.h, src/gui/chatinput.h, + src/gui/chatinput.cpp, src/net/tradehandler.cpp, + src/net/playerhandler.cpp: Upgraded to Guichan 0.6.0 (merge from + guichan-0.6.0 branch). + +2007-01-13 Bjørn Lindeijer + + * data/graphics/sprites/Makefile.am, + data/graphics/sprites/CMakeLists.txt: Updated with regard to renaming + of cotton equipment. + +2006-01-13 Eugenio Favalli + + * src/gui/debugwindow.cpp, src/gui/viewport.h: Fixed mouse coordinates + display in debug window. + +2007-01-12 Bjørn Lindeijer + + * src/gui/viewport.cpp: Fixed initialization of mPlayerFollowMouse, + the lack of which sometimes caused the player to start walking when + clicking on the GUI. + 2007-01-11 Björn Steinbrink * data/graphics/images/ambient/CMakeLists.txt, @@ -7,23 +57,43 @@ 2007-01-11 Rogier Polak * src/gui/char_select.cpp, src/net/accountserver/account.h, - src/net/accountserver/account.cpp, src/player.cpp: Fixedd issues + src/net/accountserver/account.cpp, src/player.cpp: Fixed issues with out of range hair style and color, as well as their ordering. * data/graphics/gui/Makefile.am, data/graphics/images/ambient/Makefile.am, data/graphics/sprites/Makefile.am: Some corrections to installed files. +2007-01-09 Philipp Sehmisch + + * data/graphics/icecave.png: Added new tiles and fixes by Nickman and + made some other cosmetical corrections. + 2007-01-07 Bjørn Lindeijer + * data/graphics/sprites/monster-mountsnake.xml, + data/graphics/sprites/monster-mountsnake.png, data/monsters.xml: Added + brown snake by Pauan. * src/gui/status.h, src/gui/status.cpp, src/localplayer.h: Synchronized player attributes with Attributes page on the wiki. Removed job xp bar. +2007-01-07 Philipp Sehmisch + + * data/graphics/chest-cottonshirt-male.png, + data/graphics/chest-cottonshirt-male.xml, + data/graphics/chest-cottonshirt-female.png, + data/graphics/chest-cottonshirt-female.xml, + data/graphics/item001.png, data/equipment.xml: Added female + cottonshirt sprites. + * data/equipment.xml: Fixed some wrong armor values. + 2007-01-05 Björn Steinbrink * src/CMakeLists.txt, data/graphics/sprites/CMakeLists.txt: Fixed installation when using CMake. + * src/CMakeLists.txt, data/graphics/images/ambient/Makefile.am, + data/graphics/sprites/CMakeLists.txt: Synchronized build files. 2007-01-05 Guillaume Melquiond @@ -36,6 +106,10 @@ * src/map.cpp, src/map.h: Declared some methods const. +2007-01-04 Eugenio Favalli + + * tools/Purger.java: Removed purger tool. + 2007-01-03 Guillaume Melquiond * src/resources/mapreader.cpp: Fixed memory leak on error. @@ -285,11 +359,11 @@ 2006-12-09 Bjørn Lindeijer * src/sprite.h, src/gui/playerbox.h, src/gui/char_select.cpp, - src/gui/playerbox.cpp, src/gui/passwordfield.h,src/gui/char_select.h, - src/gui/textfield.h, src/main.cpp, src/being.cpp, src/player.h, - src/floor_item.h, src/being.h: Use new animation system in character - selection/creation. Shows equipment and allowed for some cleanup. Had - a bit of help from the patch by VictorSan. + src/gui/playerbox.cpp, src/gui/passwordfield.h, src/gui/char_select.h, + src/main.cpp, src/being.cpp, src/player.h, src/floor_item.h, + src/being.h: Use new animation system in character selection/creation. + Shows equipment and allowed for some cleanup. Had a bit of help from + the patch by VictorSan. 2006-12-08 Bjørn Lindeijer diff --git a/src/game.cpp b/src/game.cpp index 2af13146..40d78248 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -124,9 +124,11 @@ const int MAX_TIME = 10000; * Listener used for exitting handling. */ namespace { - struct ExitListener : public gcn::ActionListener { - void action(const std::string &eventId, gcn::Widget *widget) { - if (eventId == "yes") { + struct ExitListener : public gcn::ActionListener + { + void action(const gcn::ActionEvent &event) + { + if (event.getId() == "yes") { done = true; } exitConfirm = NULL; @@ -386,10 +388,6 @@ void Game::logic() void Game::handleInput() { - // Get the state of the keyboard keys - Uint8* keys; - keys = SDL_GetKeyState(NULL); - if (joystick != NULL) { joystick->update(); @@ -455,7 +453,7 @@ void Game::handleInput() // Close the config window, cancelling changes if opened else if (setupWindow->isVisible()) { - setupWindow->action("cancel", NULL); + setupWindow->action(gcn::ActionEvent(NULL, "cancel")); } // Else, open the chat edit box else @@ -633,7 +631,12 @@ void Game::handleInput() current_npc == 0 && !chatWindow->isFocused()) { + // Get the state of the keyboard keys + Uint8* keys; + keys = SDL_GetKeyState(NULL); + Uint16 x = player_node->mX / 32, y = player_node->mY / 32; + unsigned char direction = 0; // Translate pressed keys to movement and direction diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 2aec84a5..65fdde64 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -98,7 +98,7 @@ void BrowserBox::disableLinksAndUserColors() mUseLinksAndUserColors = false; } -void BrowserBox::addRow(const std::string& row) +void BrowserBox::addRow(const std::string &row) { std::string tmp = row; std::string newRow; @@ -238,25 +238,28 @@ struct MouseOverLink int mX, mY; }; -void BrowserBox::mousePress(int mx, int my, int button) +void +BrowserBox::mousePressed(gcn::MouseEvent &event) { LinkIterator i = find_if(mLinks.begin(), mLinks.end(), - MouseOverLink(mx, my)); + MouseOverLink(event.getX(), event.getY())); if (i != mLinks.end()) { mLinkHandler->handleLink(i->link); } } -void BrowserBox::mouseMotion(int mx, int my) +void +BrowserBox::mouseMoved(gcn::MouseEvent &event) { LinkIterator i = find_if(mLinks.begin(), mLinks.end(), - MouseOverLink(mx, my)); + MouseOverLink(event.getX(), event.getY())); 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/browserbox.h b/src/gui/browserbox.h index a2c9dd9b..666a7754 100644 --- a/src/gui/browserbox.h +++ b/src/gui/browserbox.h @@ -61,7 +61,7 @@ class BrowserBox : public gcn::Widget, public gcn::MouseListener /** * Sets the handler for links. */ - void setLinkHandler(LinkHandler* linkHandler); + void setLinkHandler(LinkHandler *linkHandler); /** * Sets the BrowserBox opacity. @@ -81,7 +81,7 @@ class BrowserBox : public gcn::Widget, public gcn::MouseListener /** * Adds a text row to the browser. */ - void addRow(const std::string& row); + void addRow(const std::string &row); /** * Remove all rows. @@ -91,13 +91,13 @@ class BrowserBox : public gcn::Widget, public gcn::MouseListener /** * Handles mouse actions. */ - void mousePress(int mx, int my, int button); - void mouseMotion(int mx, int my); + void mousePressed(gcn::MouseEvent &event); + void mouseMoved(gcn::MouseEvent &event); /** * Draws the browser box. */ - void draw(gcn::Graphics* graphics); + void draw(gcn::Graphics *graphics); /** * BrowserBox modes. diff --git a/src/gui/buddywindow.cpp b/src/gui/buddywindow.cpp index 145f0ad2..0ed383ce 100644 --- a/src/gui/buddywindow.cpp +++ b/src/gui/buddywindow.cpp @@ -61,9 +61,9 @@ BuddyWindow::BuddyWindow(): add(cancel); } -void BuddyWindow::action(const std::string &eventId, gcn::Widget *widget) +void BuddyWindow::action(const gcn::ActionEvent &event) { - if (eventId == "Talk") { + if (event.getId() == "Talk") { int selected = mListbox->getSelected(); if ( selected > -1 ) { @@ -71,7 +71,7 @@ void BuddyWindow::action(const std::string &eventId, gcn::Widget *widget) chatWindow->setInputText(who +": "); } } - else if (eventId == "Remove") { + else if (event.getId() == "Remove") { int selected = mListbox->getSelected(); if ( selected > -1 ) { @@ -79,7 +79,7 @@ void BuddyWindow::action(const std::string &eventId, gcn::Widget *widget) mBuddyList->removeBuddy(who); } } - else if (eventId == "Cancel") { + else if (event.getId() == "Cancel") { setVisible(false); } } diff --git a/src/gui/buddywindow.h b/src/gui/buddywindow.h index 8764d008..a3ca4de2 100644 --- a/src/gui/buddywindow.h +++ b/src/gui/buddywindow.h @@ -48,7 +48,7 @@ class BuddyWindow : public Window, public gcn::ActionListener /** * Performs action. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); private: BuddyList *mBuddyList; diff --git a/src/gui/button.cpp b/src/gui/button.cpp index 31f38593..0055c89a 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -37,7 +37,7 @@ ImageRect Button::button[4]; int Button::mInstances = 0; -Button::Button(const std::string& caption, const std::string &eventId, +Button::Button(const std::string& caption, const std::string &actionEventId, gcn::ActionListener *listener): gcn::Button(caption) { @@ -73,7 +73,7 @@ Button::Button(const std::string& caption, const std::string &eventId, } mInstances++; - setEventId(eventId); + setActionEventId(actionEventId); if (listener) { addActionListener(listener); } @@ -92,7 +92,8 @@ Button::~Button() } } -void Button::draw(gcn::Graphics* graphics) +void +Button::draw(gcn::Graphics *graphics) { int mode; @@ -102,7 +103,7 @@ void Button::draw(gcn::Graphics* graphics) else if (isPressed()) { mode = 2; } - else if (hasMouse()) { + else if (mHasMouse) { mode = 1; } else { diff --git a/src/gui/button.h b/src/gui/button.h index 36d8f7a1..1c2ec41b 100644 --- a/src/gui/button.h +++ b/src/gui/button.h @@ -40,7 +40,7 @@ class Button : public gcn::Button { /** * Constructor, sets the caption of the button to the given string. */ - Button(const std::string& caption, const std::string &eventId, + Button(const std::string& caption, const std::string &actionEventId, gcn::ActionListener *listener); /** diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 102dd49e..cb07da22 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -82,8 +82,8 @@ BuyDialog::BuyDialog(): mItemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14)); mItemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14)); - mShopItemList->setEventId("item"); - mSlider->setEventId("slider"); + mShopItemList->setActionEventId("item"); + mSlider->setActionEventId("slider"); mShopItemList->addSelectionListener(this); mSlider->addActionListener(this); @@ -140,11 +140,11 @@ void BuyDialog::addItem(short id, int price) mShopItemList->adjustSize(); } -void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) +void BuyDialog::action(const gcn::ActionEvent &event) { int selectedItem = mShopItemList->getSelected(); - if (eventId == "quit") + if (event.getId() == "quit") { setVisible(false); current_npc = 0; @@ -158,12 +158,12 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) bool updateButtonsAndLabels = false; - if (eventId == "slider") + if (event.getId() == "slider") { mAmountItems = (int)(mSlider->getValue() * mMaxItems); updateButtonsAndLabels = true; } - else if (eventId == "+") + else if (event.getId() == "+") { if (mAmountItems < mMaxItems) { mAmountItems++; @@ -174,7 +174,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) mSlider->setValue(double(mAmountItems)/double(mMaxItems)); updateButtonsAndLabels = true; } - else if (eventId == "-") + else if (event.getId() == "-") { if (mAmountItems > 0) { mAmountItems--; @@ -188,7 +188,7 @@ void BuyDialog::action(const std::string &eventId, gcn::Widget *widget) // TODO: Actually we'd have a bug elsewhere if this check for the number // of items to be bought ever fails, Bertram removed the assertions, is // there a better way to ensure this fails in an _obivous_ way in C++? - else if (eventId == "buy" && (mAmountItems > 0 && + else if (event.getId() == "buy" && (mAmountItems > 0 && mAmountItems <= mMaxItems)) { // XXX Convert for new server diff --git a/src/gui/buy.h b/src/gui/buy.h index b83b6f2f..13116b6e 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -73,7 +73,7 @@ class BuyDialog : public Window, public gcn::ActionListener, SelectionListener /** * Called when receiving actions from the widgets. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); /** * Returns the number of items in the shop inventory. diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index 4bbbb2ff..ae5c7358 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -52,13 +52,13 @@ BuySellDialog::BuySellDialog(): requestFocus(); } -void BuySellDialog::action(const std::string &eventId, gcn::Widget *widget) +void BuySellDialog::action(const gcn::ActionEvent &event) { - if (eventId == "Buy") { + if (event.getId() == "Buy") { current_npc->buy(); - } else if (eventId == "Sell") { + } else if (event.getId() == "Sell") { current_npc->sell(); - } else if (eventId == "Cancel") { + } else if (event.getId() == "Cancel") { current_npc = 0; } setVisible(false); diff --git a/src/gui/buysell.h b/src/gui/buysell.h index 7a90a869..97caf34b 100644 --- a/src/gui/buysell.h +++ b/src/gui/buysell.h @@ -47,7 +47,7 @@ class BuySellDialog : public Window, public gcn::ActionListener /** * Called when receiving actions from the widgets. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); }; #endif diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index ec4dad2e..4c4b99e5 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -48,7 +48,7 @@ class CharDeleteConfirm : public ConfirmDialog { public: CharDeleteConfirm(CharSelectDialog *master); - void action(const std::string &eventId, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); private: CharSelectDialog *master; }; @@ -60,13 +60,13 @@ CharDeleteConfirm::CharDeleteConfirm(CharSelectDialog *m): { } -void CharDeleteConfirm::action(const std::string &eventId, gcn::Widget *widget) +void CharDeleteConfirm::action(const gcn::ActionEvent &event) { - //ConfirmDialog::action(eventId); - if (eventId == "yes") { + //ConfirmDialog::action(event); + if (event.getId() == "yes") { master->attemptCharDelete(); } - ConfirmDialog::action(eventId, widget); + ConfirmDialog::action(event); } CharSelectDialog::CharSelectDialog(LockedArray *charInfo): @@ -122,9 +122,9 @@ CharSelectDialog::CharSelectDialog(LockedArray *charInfo): updatePlayerInfo(); } -void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget) +void CharSelectDialog::action(const gcn::ActionEvent &event) { - if (eventId == "ok" && n_character > 0) + if (event.getId() == "ok" && n_character > 0) { // Start game mNewCharButton->setEnabled(false); @@ -136,11 +136,11 @@ void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget) Net::AccountServer::Account::selectCharacter(mCharInfo->getPos()); mCharInfo->lock(); } - else if (eventId == "cancel") + else if (event.getId() == "cancel") { state = STATE_EXIT; } - else if (eventId == "new") + else if (event.getId() == "new") { if (n_character < MAX_SLOT + 1) { @@ -150,7 +150,7 @@ void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget) mCharInfo->unlock(); } } - else if (eventId == "delete") + else if (event.getId() == "delete") { // Delete character if (mCharInfo->getEntry()) @@ -158,11 +158,11 @@ void CharSelectDialog::action(const std::string &eventId, gcn::Widget *widget) new CharDeleteConfirm(this); } } - else if (eventId == "previous") + else if (event.getId() == "previous") { mCharInfo->prev(); } - else if (eventId == "next") + else if (event.getId() == "next") { mCharInfo->next(); } @@ -253,7 +253,7 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot): mCancelButton = new Button("Cancel", "cancel", this); mPlayerBox = new PlayerBox(mPlayer); - mNameField->setEventId("create"); + mNameField->setActionEventId("create"); int w = 200; int h = 150; @@ -298,9 +298,9 @@ CharCreateDialog::~CharCreateDialog() delete mPlayer; } -void CharCreateDialog::action(const std::string &eventId, gcn::Widget *widget) +void CharCreateDialog::action(const gcn::ActionEvent &event) { - if (eventId == "create") { + if (event.getId() == "create") { if (getName().length() >= 4) { // Attempt to create the character mCreateButton->setEnabled(false); @@ -322,20 +322,20 @@ void CharCreateDialog::action(const std::string &eventId, gcn::Widget *widget) "Your name needs to be at least 4 characters.", this); } } - else if (eventId == "cancel") { + else if (event.getId() == "cancel") { scheduleDelete(); } - else if (eventId == "nextcolor") { + else if (event.getId() == "nextcolor") { mPlayer->setHairColor((mPlayer->getHairColor() + 1) % NR_HAIR_COLORS); } - else if (eventId == "prevcolor") { + else if (event.getId() == "prevcolor") { int prevColor = mPlayer->getHairColor() + NR_HAIR_COLORS - 1; mPlayer->setHairColor(prevColor % NR_HAIR_COLORS); } - else if (eventId == "nextstyle") { + else if (event.getId() == "nextstyle") { mPlayer->setHairStyle((mPlayer->getHairStyle() + 1) % NR_HAIR_STYLES); } - else if (eventId == "prevstyle") { + else if (event.getId() == "prevstyle") { int prevStyle = mPlayer->getHairStyle() + NR_HAIR_STYLES - 1; mPlayer->setHairStyle(prevStyle % NR_HAIR_STYLES); } diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 9d2d77da..d6dee8b5 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -49,7 +49,7 @@ class CharSelectDialog : public Window, public gcn::ActionListener */ CharSelectDialog(LockedArray *charInfo); - void action(const std::string &eventId, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); void updatePlayerInfo(); @@ -109,7 +109,7 @@ class CharCreateDialog : public Window, public gcn::ActionListener */ ~CharCreateDialog(); - void action(const std::string &eventId, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); std::string getName(); diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 3dc252ab..d992c6dd 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -53,7 +53,7 @@ ChatWindow::ChatWindow(): loadWindowState(); mChatInput = new ChatInput(); - mChatInput->setEventId("chatinput"); + mChatInput->setActionEventId("chatinput"); mChatInput->addActionListener(this); mTextOutput = new BrowserBox(BrowserBox::AUTO_WRAP); @@ -180,9 +180,9 @@ ChatWindow::chatLog(CHATSKILL act) } void -ChatWindow::action(const std::string &eventId, gcn::Widget *widget) +ChatWindow::action(const gcn::ActionEvent &event) { - if (eventId == "chatinput") + if (event.getId() == "chatinput") { std::string message = mChatInput->getText(); @@ -360,9 +360,10 @@ ChatWindow::const_msg(CHATSKILL act) } void -ChatWindow::keyPress(const gcn::Key &key) +ChatWindow::keyPressed(gcn::KeyEvent &event) { - if (key.getValue() == key.DOWN && mCurHist != mHistory.end()) + if (event.getKey().getValue() == gcn::Key::DOWN && + mCurHist != mHistory.end()) { // Move forward through the history HistoryIterator prevHist = mCurHist++; @@ -374,8 +375,8 @@ ChatWindow::keyPress(const gcn::Key &key) mCurHist = prevHist; } } - else if (key.getValue() == key.UP && mCurHist != mHistory.begin() && - mHistory.size() > 0) + else if (event.getKey().getValue() == gcn::Key::UP && + mCurHist != mHistory.begin() && mHistory.size() > 0) { // Move backward through the history mCurHist--; diff --git a/src/gui/chat.h b/src/gui/chat.h index a0a3d1ec..963e5e98 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -138,7 +138,7 @@ class ChatWindow : public Window, public gcn::ActionListener, /** * Performs action. */ - void action(const std::string& actionId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); /** * Request focus for typing chat message. @@ -178,13 +178,16 @@ class ChatWindow : public Window, public gcn::ActionListener, chatSend(const std::string &nick, std::string msg); /** Called when key is pressed */ - void keyPress(const gcn::Key& key); + void + keyPressed(gcn::KeyEvent &event); /** Called to set current text */ - void setInputText(std::string input_str); + void + setInputText(std::string input_str); /** Override to reset mTmpVisible */ - void setVisible(bool visible); + void + setVisible(bool visible); private: bool mTmpVisible; diff --git a/src/gui/chatinput.cpp b/src/gui/chatinput.cpp index 52e91f3a..2aa5a159 100644 --- a/src/gui/chatinput.cpp +++ b/src/gui/chatinput.cpp @@ -28,7 +28,7 @@ ChatInput::ChatInput() setVisible(false); } -void ChatInput::lostFocus() +void ChatInput::focusLost() { setVisible(false); } diff --git a/src/gui/chatinput.h b/src/gui/chatinput.h index 9f543e24..59d0daf3 100644 --- a/src/gui/chatinput.h +++ b/src/gui/chatinput.h @@ -41,7 +41,7 @@ class ChatInput : public TextField * Called if the chat input loses focus. It will set itself to * invisible as result. */ - void lostFocus(); + void focusLost(); }; #endif diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp index 5a70544f..0ff8be17 100644 --- a/src/gui/confirm_dialog.cpp +++ b/src/gui/confirm_dialog.cpp @@ -65,17 +65,18 @@ ConfirmDialog::ConfirmDialog(const std::string &title, const std::string &msg, yesButton->requestFocus(); } -void ConfirmDialog::action(const std::string &eventId, gcn::Widget *widget) +void ConfirmDialog::action(const gcn::ActionEvent &event) { // Proxy button events to our listeners ActionListenerIterator i; for (i = mActionListeners.begin(); i != mActionListeners.end(); ++i) { - (*i)->action(eventId, widget); + (*i)->action(event); } // Can we receive anything else anyway? - if (eventId == "yes" || eventId == "no") { + if (event.getId() == "yes" || event.getId() == "no") + { scheduleDelete(); } } diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h index 771ecc36..8728f83f 100644 --- a/src/gui/confirm_dialog.h +++ b/src/gui/confirm_dialog.h @@ -47,7 +47,7 @@ class ConfirmDialog : public Window, public gcn::ActionListener { /** * Called when receiving actions from the widgets. */ - void action(const std::string &eventId, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); }; #endif diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp index 7e977f1f..3627689a 100644 --- a/src/gui/connection.cpp +++ b/src/gui/connection.cpp @@ -38,7 +38,7 @@ namespace { ConnectionActionListener(unsigned char previousState): mPreviousState(previousState) {}; - void action(const std::string &eventId, gcn::Widget *widget) { + void action(const gcn::ActionEvent &event) { state = mPreviousState; } @@ -51,9 +51,11 @@ ConnectionDialog::ConnectionDialog(unsigned char previousState): { setContentSize(200, 100); - ConnectionActionListener *connectionListener = new ConnectionActionListener(previousState); + ConnectionActionListener *connectionListener = + new ConnectionActionListener(previousState); - Button *cancelButton = new Button("Cancel", "cancelButton", connectionListener); + Button *cancelButton = new Button("Cancel", "cancelButton", + connectionListener); mProgressBar = new ProgressBar(0.0, 200 - 10, 20, 128, 128, 128); gcn::Label *label = new gcn::Label("Connecting..."); diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index f8a4154e..563f380f 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -28,6 +28,8 @@ #include #include "button.h" +#include "gui.h" +#include "viewport.h" #include "../game.h" #include "../engine.h" @@ -72,15 +74,15 @@ DebugWindow::logic() // Get the current mouse position int mouseX, mouseY; SDL_GetMouseState(&mouseX, &mouseY); - //int mouseTileX = mouseX / 32 + camera_x; - //int mouseTileY = mouseY / 32 + camera_y; + int mouseTileX = mouseX / 32 + viewport->getCameraX(); + int mouseTileY = mouseY / 32 + viewport->getCameraY(); mFPSLabel->setCaption("[" + toString(fps) + " FPS"); mFPSLabel->adjustSize(); - //mTileMouseLabel->setCaption("[Mouse: " + - // toString(mouseTileX) + ", " + toString(mouseTileY) + "]"); - //mTileMouseLabel->adjustSize(); + mTileMouseLabel->setCaption("[Mouse: " + + toString(mouseTileX) + ", " + toString(mouseTileY) + "]"); + mTileMouseLabel->adjustSize(); Map *currentMap = engine->getCurrentMap(); if (currentMap != NULL) @@ -98,9 +100,9 @@ DebugWindow::logic() } void -DebugWindow::action(const std::string &eventId, gcn::Widget *widget) +DebugWindow::action(const gcn::ActionEvent &event) { - if (eventId == "close") + if (event.getId() == "close") { setVisible(false); } diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index 61ef44e6..4fd33d83 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -53,7 +53,7 @@ class DebugWindow : public Window, public gcn::ActionListener /** * Performs action. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); private: gcn::Label *mMusicFileLabel, *mMapFileLabel; diff --git a/src/gui/gccontainer.cpp b/src/gui/gccontainer.cpp index 3b574622..c22ddfc9 100644 --- a/src/gui/gccontainer.cpp +++ b/src/gui/gccontainer.cpp @@ -55,8 +55,8 @@ void GCContainer::add(gcn::Widget *w, int x, int y, bool delChild) Container::add(w, x, y); } -void GCContainer::_announceDeath(gcn::Widget *w) +void GCContainer::death(const gcn::Event &event) { - mDeathList.remove(w); - Container::_announceDeath(w); + mDeathList.remove(event.getSource()); + Container::death(event); } diff --git a/src/gui/gccontainer.h b/src/gui/gccontainer.h index 46ebfefa..e27eaa96 100644 --- a/src/gui/gccontainer.h +++ b/src/gui/gccontainer.h @@ -32,9 +32,12 @@ class GCContainer : public gcn::Container { public: virtual ~GCContainer(); - virtual void add(gcn::Widget *w, bool delChild=true); - virtual void add(gcn::Widget *w, int x, int y, bool delChild=true); - virtual void _announceDeath(gcn::Widget *w); + + virtual void add(gcn::Widget *w, bool delChild = true); + + virtual void add(gcn::Widget *w, int x, int y, bool delChild = true); + + virtual void death(const gcn::Event &event); protected: typedef std::list Widgets; diff --git a/src/gui/help.cpp b/src/gui/help.cpp index e7429b29..0b010253 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -54,9 +54,9 @@ HelpWindow::HelpWindow(): setLocationRelativeTo(getParent()); } -void HelpWindow::action(const std::string &eventId, gcn::Widget *widget) +void HelpWindow::action(const gcn::ActionEvent &event) { - if (eventId == "close") + if (event.getId() == "close") { setVisible(false); } diff --git a/src/gui/help.h b/src/gui/help.h index 539ab31b..3c3715a0 100644 --- a/src/gui/help.h +++ b/src/gui/help.h @@ -48,7 +48,7 @@ class HelpWindow : public Window, public LinkHandler, /** * Called when receiving actions from the widgets. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); /** * Handles link action. diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp index 92f21e5f..2a09f255 100644 --- a/src/gui/inttextbox.cpp +++ b/src/gui/inttextbox.cpp @@ -32,12 +32,15 @@ IntTextBox::IntTextBox(int i): { } -void IntTextBox::keyPress(const gcn::Key &key) +void +IntTextBox::keyPressed(gcn::KeyEvent &event) { + const gcn::Key &key = event.getKey(); + if (key.isNumber() || key.getValue() == gcn::Key::BACKSPACE || key.getValue() == gcn::Key::DELETE) { - gcn::TextBox::keyPress(key); + gcn::TextBox::keyPressed(event); } std::stringstream s(gcn::TextBox::getText()); diff --git a/src/gui/inttextbox.h b/src/gui/inttextbox.h index b199cb2f..b5d339ac 100644 --- a/src/gui/inttextbox.h +++ b/src/gui/inttextbox.h @@ -55,7 +55,8 @@ class IntTextBox : public TextBox /** * Responds to key presses. */ - void keyPress(const gcn::Key &key); + void + keyPressed(gcn::KeyEvent &event); private: int mMin; /**< Minimum value */ diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 7f9ba3b9..e533c16c 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -99,7 +99,7 @@ void InventoryWindow::logic() mWeightLabel->adjustSize(); } -void InventoryWindow::action(const std::string &eventId, gcn::Widget *widget) +void InventoryWindow::action(const gcn::ActionEvent &event) { Item *item = mItems->getItem(); @@ -107,7 +107,7 @@ void InventoryWindow::action(const std::string &eventId, gcn::Widget *widget) return; } - if (eventId == "use") { + if (event.getId() == "use") { if (item->isEquipment()) { if (item->isEquipped()) { player_node->unequipItem(item); @@ -120,7 +120,7 @@ void InventoryWindow::action(const std::string &eventId, gcn::Widget *widget) player_node->useItem(item); } } - else if (eventId == "drop") + else if (event.getId() == "drop") { // Choose amount of items to drop new ItemAmountWindow(AMOUNT_ITEM_DROP, this, item); @@ -155,11 +155,11 @@ void InventoryWindow::selectionChanged(const SelectionEvent &event) } } -void InventoryWindow::mouseClick(int x, int y, int button, int count) +void InventoryWindow::mouseClicked(gcn::MouseEvent &event) { - Window::mouseClick(x, y, button, count); + Window::mouseClicked(event); - if (button == gcn::MouseInput::RIGHT) + if (event.getButton() == gcn::MouseEvent::RIGHT) { Item *item = mItems->getItem(); @@ -168,16 +168,16 @@ void InventoryWindow::mouseClick(int x, int y, int button, int count) /* Convert relative to the window coordinates to * absolute screen coordinates. */ - int mx = x + getX(); - int my = y + getY(); + int mx = event.getX() + getX(); + int my = event.getY() + getY(); viewport->showPopup(mx, my, item); } } -void InventoryWindow::mouseMotion(int mx, int my) +void InventoryWindow::mouseDragged(gcn::MouseEvent &event) { int tmpWidth = getWidth(), tmpHeight = getHeight(); - Window::mouseMotion(mx, my); + Window::mouseDragged(event); if (getWidth() != tmpWidth || getHeight() != tmpHeight) { updateWidgets(); } diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index d46e91e7..5ee89fef 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -55,11 +55,11 @@ class InventoryWindow : public Window, gcn::ActionListener, SelectionListener /** * Called when receiving actions from the widgets. */ - void action(const std::string &eventId, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); - void mouseClick(int x, int y, int button, int count); + void mouseClicked(gcn::MouseEvent &event); - void mouseMotion(int mx, int my); + void mouseDragged(gcn::MouseEvent &event); Item* getItem(); diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp index 5ebc0213..f72462f9 100644 --- a/src/gui/item_amount.cpp +++ b/src/gui/item_amount.cpp @@ -49,7 +49,7 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item): mItemAmountSlide->setDimension(gcn::Rectangle(5, 120, 180, 10)); // Set button events Id - mItemAmountSlide->setEventId("Slide"); + mItemAmountSlide->setActionEventId("Slide"); // Set position mItemAmountTextBox->setPosition(35, 10); @@ -75,11 +75,11 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item): switch (usage) { case AMOUNT_TRADE_ADD: setCaption("Select amount of items to trade."); - okButton->setEventId("AddTrade"); + okButton->setActionEventId("AddTrade"); break; case AMOUNT_ITEM_DROP: setCaption("Select amount of items to drop."); - okButton->setEventId("Drop"); + okButton->setActionEventId("Drop"); break; default: break; @@ -95,33 +95,33 @@ void ItemAmountWindow::resetAmount() mItemAmountTextBox->setInt(1); } -void ItemAmountWindow::action(const std::string &eventId, gcn::Widget *widget) +void ItemAmountWindow::action(const gcn::ActionEvent &event) { int amount = mItemAmountTextBox->getInt(); - if (eventId == "Cancel") + if (event.getId() == "Cancel") { scheduleDelete(); } - else if (eventId == "Drop") + else if (event.getId() == "Drop") { player_node->dropItem(mItem, mItemAmountTextBox->getInt()); scheduleDelete(); } - else if (eventId == "AddTrade") + else if (event.getId() == "AddTrade") { tradeWindow->tradeItem(mItem, mItemAmountTextBox->getInt()); scheduleDelete(); } - else if (eventId == "Plus") + else if (event.getId() == "Plus") { amount++; } - else if (eventId == "Minus") + else if (event.getId() == "Minus") { amount--; } - else if (eventId == "Slide") + else if (event.getId() == "Slide") { amount = static_cast(mItemAmountSlide->getValue()); } diff --git a/src/gui/item_amount.h b/src/gui/item_amount.h index a2a17575..01319012 100644 --- a/src/gui/item_amount.h +++ b/src/gui/item_amount.h @@ -54,7 +54,7 @@ class ItemAmountWindow : public Window, public gcn::ActionListener /** * Called when receiving actions from widget. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); /** * Sets default amount value. diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 2c84b19b..308311b7 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -58,7 +58,8 @@ ItemContainer::~ItemContainer() mSelImg->decRef(); } -void ItemContainer::logic() +void +ItemContainer::logic() { gcn::Widget::logic(); @@ -70,7 +71,8 @@ void ItemContainer::logic() } } -void ItemContainer::draw(gcn::Graphics* graphics) +void +ItemContainer::draw(gcn::Graphics *graphics) { int gridWidth = 36; //(item icon width + 4) int gridHeight = 42; //(item icon height + 10) @@ -124,7 +126,8 @@ void ItemContainer::draw(gcn::Graphics* graphics) } } -void ItemContainer::setWidth(int width) +void +ItemContainer::setWidth(int width) { gcn::Widget::setWidth(width); @@ -140,17 +143,20 @@ void ItemContainer::setWidth(int width) setHeight((mMaxItems + columns - 1) / columns * gridHeight); } -Item* ItemContainer::getItem() +Item* +ItemContainer::getItem() { return mSelectedItem; } -void ItemContainer::selectNone() +void +ItemContainer::selectNone() { setSelectedItem(NULL); } -void ItemContainer::setSelectedItem(Item *item) +void +ItemContainer::setSelectedItem(Item *item) { if (mSelectedItem != item) { @@ -159,7 +165,8 @@ void ItemContainer::setSelectedItem(Item *item) } } -void ItemContainer::fireSelectionChangedEvent() +void +ItemContainer::fireSelectionChangedEvent() { SelectionEvent event(this); SelectionListeners::iterator i_end = mListeners.end(); @@ -171,14 +178,18 @@ void ItemContainer::fireSelectionChangedEvent() } } -void ItemContainer::mousePress(int mx, int my, int button) +void +ItemContainer::mousePressed(gcn::MouseEvent &event) { - int gridWidth = 36; //(item icon width + 4) - int gridHeight = 42; //(item icon height + 10) - int columns = getWidth() / gridWidth; + int button = event.getButton(); - if (button == gcn::MouseInput::LEFT || gcn::MouseInput::RIGHT) + if (button == gcn::MouseEvent::LEFT || button == gcn::MouseEvent::RIGHT) { + int gridWidth = 36; //(item icon width + 4) + int gridHeight = 42; //(item icon height + 10) + int columns = getWidth() / gridWidth; + int mx = event.getX(); + int my = event.getY(); int index = mx / gridWidth + ((my / gridHeight) * columns); if (index > INVENTORY_SIZE) { diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index a2d5f0f7..8c548fcd 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -71,7 +71,7 @@ class ItemContainer : public gcn::Widget, public gcn::MouseListener /** * Handles mouse click. */ - void mousePress(int mx, int my, int button); + void mousePressed(gcn::MouseEvent &event); /** * Returns the selected item. diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index d4a2c6cb..a7f6df8d 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -31,8 +31,7 @@ #include ListBox::ListBox(gcn::ListModel *listModel): - gcn::ListBox(listModel), - mMousePressed(false) + gcn::ListBox(listModel) { } @@ -61,39 +60,19 @@ void ListBox::draw(gcn::Graphics *graphics) } } -void ListBox::setSelected(int selected) +void +ListBox::setSelected(int selected) { gcn::ListBox::setSelected(selected); fireSelectionChangedEvent(); } -void ListBox::mousePress(int x, int y, int button) +void +ListBox::mouseDragged(gcn::MouseEvent &event) { - gcn::ListBox::mousePress(x, y, button); - - if (button == gcn::MouseInput::LEFT && hasMouse()) - { - mMousePressed = true; - } -} - -void ListBox::mouseRelease(int x, int y, int button) -{ - gcn::ListBox::mouseRelease(x, y, button); - - mMousePressed = false; -} - -void ListBox::mouseMotion(int x, int y) -{ - gcn::ListBox::mouseMotion(x, y); - // Pretend mouse is pressed continuously while dragged. Causes list // selection to be updated as is default in many GUIs. - if (mMousePressed) - { - mousePress(x, y, gcn::MouseInput::LEFT); - } + mousePressed(event); } void ListBox::fireSelectionChangedEvent() diff --git a/src/gui/listbox.h b/src/gui/listbox.h index deca07cf..1d480eb1 100644 --- a/src/gui/listbox.h +++ b/src/gui/listbox.h @@ -48,9 +48,7 @@ class ListBox : public gcn::ListBox */ void draw(gcn::Graphics *graphics); - void mousePress(int x, int y, int button); - void mouseRelease(int x, int y, int button); - void mouseMotion(int x, int y); + void mouseDragged(gcn::MouseEvent &event); /** * Adds a listener to the list that's notified each time a change to @@ -81,8 +79,6 @@ class ListBox : public gcn::ListBox */ void fireSelectionChangedEvent(); - bool mMousePressed; /**< Keeps track of mouse pressed status. */ - std::list mListeners; }; diff --git a/src/gui/login.cpp b/src/gui/login.cpp index b8d4df2b..664074aa 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -43,9 +43,9 @@ WrongDataNoticeListener::setTarget(gcn::TextField *textField) } void -WrongDataNoticeListener::action(const std::string &eventId, gcn::Widget *widget) +WrongDataNoticeListener::action(const gcn::ActionEvent &event) { - if (eventId == "ok") + if (event.getId() == "ok") { // Reset the field mTarget->setText(""); @@ -85,8 +85,8 @@ LoginDialog::LoginDialog(LoginData *loginData): mKeepCheck->getX() + mKeepCheck->getWidth() + 10, 91 - mRegisterButton->getHeight() - 5); - mUserField->setEventId("ok"); - mPassField->setEventId("ok"); + mUserField->setActionEventId("ok"); + mPassField->setActionEventId("ok"); mUserField->addActionListener(this); mPassField->addActionListener(this); @@ -119,9 +119,9 @@ LoginDialog::~LoginDialog() } void -LoginDialog::action(const std::string &eventId, gcn::Widget *widget) +LoginDialog::action(const gcn::ActionEvent &event) { - if (eventId == "ok") + if (event.getId() == "ok") { // Check login if (mUserField->getText().empty()) @@ -142,11 +142,11 @@ LoginDialog::action(const std::string &eventId, gcn::Widget *widget) state = STATE_LOGIN_ATTEMPT; } } - else if (eventId == "cancel") + else if (event.getId() == "cancel") { state = STATE_EXIT; } - else if (eventId == "register") + else if (event.getId() == "register") { state = STATE_REGISTER; } diff --git a/src/gui/login.h b/src/gui/login.h index 6d510da7..05c0da31 100644 --- a/src/gui/login.h +++ b/src/gui/login.h @@ -38,7 +38,7 @@ class LoginData; class WrongDataNoticeListener : public gcn::ActionListener { public: void setTarget(gcn::TextField *textField); - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); private: gcn::TextField *mTarget; }; @@ -65,7 +65,7 @@ class LoginDialog : public Window, public gcn::ActionListener { /** * Called when receiving actions from the widgets. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); private: gcn::TextField *mUserField; diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp index a1b342f0..ba4c8e94 100644 --- a/src/gui/menuwindow.cpp +++ b/src/gui/menuwindow.cpp @@ -39,7 +39,7 @@ namespace { /** * Called when receiving actions from widget. */ - void action(const std::string &eventId, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); } listener; } @@ -75,26 +75,26 @@ void MenuWindow::draw(gcn::Graphics *graphics) } -void MenuWindowListener::action(const std::string &eventId, gcn::Widget *widget) +void MenuWindowListener::action(const gcn::ActionEvent &event) { Window *window = NULL; - if (eventId == "Status") + if (event.getId() == "Status") { window = statusWindow; } - else if (eventId == "Equipment") + else if (event.getId() == "Equipment") { window = equipmentWindow; } - else if (eventId == "Inventory") + else if (event.getId() == "Inventory") { window = inventoryWindow; } - else if (eventId == "Skills") + else if (event.getId() == "Skills") { window = skillDialog; } - else if (eventId == "Setup") + else if (event.getId() == "Setup") { window = setupWindow; } diff --git a/src/gui/newskill.cpp b/src/gui/newskill.cpp index 7f5de543..6783a546 100644 --- a/src/gui/newskill.cpp +++ b/src/gui/newskill.cpp @@ -121,46 +121,46 @@ NewSkillDialog::NewSkillDialog(): setLocationRelativeTo(getParent()); } -void NewSkillDialog::action(const std::string &eventId, gcn::Widget *widget) +void NewSkillDialog::action(const gcn::ActionEvent &event) { - int osp = startPoint; - if (eventId == "close") + int osp = startPoint; + if (event.getId() == "close") { setVisible(false); } - else if (eventId == "g1") // weapons group 0-9 + else if (event.getId() == "g1") // weapons group 0-9 { startPoint =0; } - else if (eventId == "g2") // magic group 10-19 + else if (event.getId() == "g2") // magic group 10-19 { startPoint =10; } - else if (eventId == "g3") // craft group 20-29 + else if (event.getId() == "g3") // craft group 20-29 { startPoint =20; } - else if (eventId == "g4") // general group 30-39 + else if (event.getId() == "g4") // general group 30-39 { startPoint =30; } - else if (eventId == "g5") // combat group 40-49 + else if (event.getId() == "g5") // combat group 40-49 { startPoint =40; } - else if (eventId == "g6") // e. resist group 50-59 + else if (event.getId() == "g6") // e. resist group 50-59 { startPoint =50; } - else if (eventId == "g7") // s resist group 60-69 + else if (event.getId() == "g7") // s resist group 60-69 { startPoint =60; } - else if (eventId == "g8") // hunting group 70-79 + else if (event.getId() == "g8") // hunting group 70-79 { startPoint =70; } - else if (eventId == "g9") // stats group 80-89 + else if (event.getId() == "g9") // stats group 80-89 { startPoint =80; } diff --git a/src/gui/newskill.h b/src/gui/newskill.h index 224574bd..6e12169f 100644 --- a/src/gui/newskill.h +++ b/src/gui/newskill.h @@ -55,7 +55,7 @@ class NewSkillDialog : public Window, public gcn::ActionListener NewSkillDialog(); // action listener - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); private: void resetNSD(); // updates the values in the dialog box diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index 5b7ca439..2dd223bd 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -67,9 +67,9 @@ NpcTextDialog::addText(const std::string &text) } void -NpcTextDialog::action(const std::string &eventId, gcn::Widget *widget) +NpcTextDialog::action(const gcn::ActionEvent &event) { - if (eventId == "ok") + if (event.getId() == "ok") { setText(""); setVisible(false); diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index 3ce1215d..869661c4 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.h @@ -49,7 +49,7 @@ class NpcTextDialog : public Window, public gcn::ActionListener * Called when receiving actions from the widgets. */ void - action(const std::string& eventId, gcn::Widget* widget); + action(const gcn::ActionEvent &event); /** * Sets the text shows in the dialog. diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index d1c3ddcb..1bcdc8ff 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -50,7 +50,7 @@ NpcListDialog::NpcListDialog(): cancelButton->getX() - 5 - okButton->getWidth(), cancelButton->getY()); - mItemList->setEventId("item"); + mItemList->setActionEventId("item"); mItemList->addActionListener(this); @@ -91,11 +91,11 @@ NpcListDialog::reset() } void -NpcListDialog::action(const std::string &eventId, gcn::Widget *widget) +NpcListDialog::action(const gcn::ActionEvent &event) { int choice = 0; - if (eventId == "ok") + if (event.getId() == "ok") { // Send the selected index back to the server int selectedIndex = mItemList->getSelected(); @@ -104,7 +104,7 @@ NpcListDialog::action(const std::string &eventId, gcn::Widget *widget) choice = selectedIndex + 1; } } - else if (eventId == "cancel") + else if (event.getId() == "cancel") { choice = 0xff; // 0xff means cancel } diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h index 03b76681..c09b0a8c 100644 --- a/src/gui/npclistdialog.h +++ b/src/gui/npclistdialog.h @@ -54,7 +54,7 @@ class NpcListDialog : public Window, public gcn::ActionListener, * Called when receiving actions from the widgets. */ void - action(const std::string& eventId, gcn::Widget* widget); + action(const gcn::ActionEvent &event); /** * Returns the number of items in the choices list. diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp index 4f9623d7..ca9d2a7b 100644 --- a/src/gui/ok_dialog.cpp +++ b/src/gui/ok_dialog.cpp @@ -55,17 +55,17 @@ OkDialog::OkDialog(const std::string &title, const std::string &msg, okButton->requestFocus(); } -void OkDialog::action(const std::string &eventId, gcn::Widget *widget) +void OkDialog::action(const gcn::ActionEvent &event) { // Proxy button events to our listeners ActionListenerIterator i; for (i = mActionListeners.begin(); i != mActionListeners.end(); ++i) { - (*i)->action(eventId, widget); + (*i)->action(event); } // Can we receive anything else anyway? - if (eventId == "ok") { + if (event.getId() == "ok") { scheduleDelete(); } } diff --git a/src/gui/ok_dialog.h b/src/gui/ok_dialog.h index 8ae08955..a7b24a90 100644 --- a/src/gui/ok_dialog.h +++ b/src/gui/ok_dialog.h @@ -46,7 +46,7 @@ class OkDialog : public Window, public gcn::ActionListener { /** * Called when receiving actions from the widgets. */ - void action(const std::string &eventId, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); }; #endif diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index 5fbe79b7..fad156f1 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -28,7 +28,6 @@ #include "../resources/image.h" #include "../resources/resourcemanager.h" -#include "../resources/spriteset.h" #include "../utils/dtor.h" diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 70cd6dc4..4539e48e 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -108,13 +108,13 @@ RegisterDialog::~RegisterDialog() } void -RegisterDialog::action(const std::string &eventId, gcn::Widget *widget) +RegisterDialog::action(const gcn::ActionEvent &event) { - if (eventId == "cancel") + if (event.getId() == "cancel") { state = STATE_LOGIN; } - else if (eventId == "register") + else if (event.getId() == "register") { const std::string user = mUserField->getText(); logger->log("RegisterDialog::register Username is %s", user.c_str()); diff --git a/src/gui/register.h b/src/gui/register.h index 4c98788f..4ffe451f 100644 --- a/src/gui/register.h +++ b/src/gui/register.h @@ -56,7 +56,7 @@ class RegisterDialog : public Window, public gcn::ActionListener { /** * Called when receiving actions from the widgets. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); // Made them public to have the possibility to request focus // from external functions. diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index b0957f9e..c9878c84 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -87,8 +87,8 @@ SellDialog::SellDialog(): quitButton->setPosition(208, 186); - mShopItemList->setEventId("item"); - mSlider->setEventId("mSlider"); + mShopItemList->setActionEventId("item"); + mSlider->setActionEventId("mSlider"); mShopItemList->setPriceCheck(false); @@ -154,11 +154,11 @@ void SellDialog::addItem(Item *item, int price) mShopItemList->adjustSize(); } -void SellDialog::action(const std::string &eventId, gcn::Widget *widget) +void SellDialog::action(const gcn::ActionEvent &event) { int selectedItem = mShopItemList->getSelected(); - if (eventId == "item") + if (event.getId() == "item") { mAmountItems = 0; mSlider->setValue(0); @@ -182,7 +182,7 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) } mQuantityLabel->adjustSize(); } - else if (eventId == "quit") + else if (event.getId() == "quit") { setVisible(false); current_npc = 0; @@ -195,13 +195,13 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) bool updateButtonsAndLabels = false; - if (eventId == "mSlider") + if (event.getId() == "mSlider") { mAmountItems = (int)(mSlider->getValue() * mMaxItems); updateButtonsAndLabels = true; } - else if (eventId == "+") + else if (event.getId() == "+") { assert(mAmountItems < mMaxItems); mAmountItems++; @@ -209,7 +209,7 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) updateButtonsAndLabels = true; } - else if (eventId == "-") + else if (event.getId() == "-") { assert(mAmountItems > 0); mAmountItems--; @@ -218,7 +218,7 @@ void SellDialog::action(const std::string &eventId, gcn::Widget *widget) updateButtonsAndLabels = true; } - else if (eventId == "sell") + else if (event.getId() == "sell") { // Attempt sell assert(mAmountItems > 0 && mAmountItems <= mMaxItems); diff --git a/src/gui/sell.h b/src/gui/sell.h index ba324576..68bd7b8b 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -68,7 +68,7 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener /** * Called when receiving actions from the widgets. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); /** * Updates labels according to selected item. diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index bd17bff7..bf29f0d3 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -44,9 +44,9 @@ const short MAX_SERVERLIST = 5; void -DropDownListener::action(const std::string &eventId, gcn::Widget *widget) +DropDownListener::action(const gcn::ActionEvent &event) { - if (eventId == "ok") + if (event.getId() == "ok") { // Reset the text fields and give back the server dialog. mServerNameField->setText(""); @@ -56,13 +56,14 @@ DropDownListener::action(const std::string &eventId, gcn::Widget *widget) mServerNameField->requestFocus(); } - else if (eventId == "changeSelection") + else if (event.getId() == "changeSelection") { // Change the textField Values according to new selection if (currentSelectedIndex != mServersListBox->getSelected()) { Server myServer; - myServer = mServersListModel->getServer(mServersListBox->getSelected()); + myServer = mServersListModel->getServer( + mServersListBox->getSelected()); mServerNameField->setText(myServer.serverName); mServerPortField->setText(toString(myServer.port)); currentSelectedIndex = mServersListBox->getSelected(); @@ -131,7 +132,7 @@ ServerDialog::ServerDialog(LoginData *loginData): mMostUsedServersScrollArea, mMostUsedServersListBox); mDropDownListener = new DropDownListener(mServerNameField, mPortField, - mMostUsedServersListModel, mMostUsedServersListBox); + mMostUsedServersListModel, mMostUsedServersListBox); mOkButton = new Button("OK", "ok", this); mCancelButton = new Button("Cancel", "cancel", this); @@ -157,9 +158,9 @@ ServerDialog::ServerDialog(LoginData *loginData): mCancelButton->getX() - mOkButton->getWidth() - 5, 100 - mOkButton->getHeight() - 5); - mServerNameField->setEventId("ok"); - mPortField->setEventId("ok"); - mMostUsedServersDropDown->setEventId("changeSelection"); + mServerNameField->setActionEventId("ok"); + mPortField->setActionEventId("ok"); + mMostUsedServersDropDown->setActionEventId("changeSelection"); mServerNameField->addActionListener(this); mPortField->addActionListener(this); @@ -193,9 +194,9 @@ ServerDialog::~ServerDialog() } void -ServerDialog::action(const std::string &eventId, gcn::Widget *widget) +ServerDialog::action(const gcn::ActionEvent &event) { - if (eventId == "ok") + if (event.getId() == "ok") { // Check login if (mServerNameField->getText().empty() || mPortField->getText().empty()) @@ -240,7 +241,7 @@ ServerDialog::action(const std::string &eventId, gcn::Widget *widget) state = STATE_CONNECT_ACCOUNT; } } - else if (eventId == "cancel") + else if (event.getId() == "cancel") { state = STATE_EXIT; } diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h index d907f340..2bb0609f 100644 --- a/src/gui/serverdialog.h +++ b/src/gui/serverdialog.h @@ -98,8 +98,7 @@ class DropDownListener : public gcn::ActionListener mServerPortField(serverPortField), mServersListModel(serversListModel), mServersListBox(serversListBox) {}; - void action(const std::string& eventId, - gcn::Widget* widget); + void action(const gcn::ActionEvent &event); private: short currentSelectedIndex; gcn::TextField *mServerNameField; @@ -132,7 +131,7 @@ class ServerDialog : public Window, public gcn::ActionListener /** * Called when receiving actions from the widgets. */ - void action(const std::string &eventId, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); private: gcn::TextField *mServerNameField; diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 78b10498..3add3a18 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -85,19 +85,19 @@ Setup::~Setup() for_each(mTabs.begin(), mTabs.end(), make_dtor(mTabs)); } -void Setup::action(const std::string& event, gcn::Widget *widget) +void Setup::action(const gcn::ActionEvent &event) { - if (event == "Apply") + if (event.getId() == "Apply") { setVisible(false); for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::apply)); } - else if (event == "Cancel") + else if (event.getId() == "Cancel") { setVisible(false); for_each(mTabs.begin(), mTabs.end(), std::mem_fun(&SetupTab::cancel)); } - else if (event == "Reset Windows") + else if (event.getId() == "Reset Windows") { statusWindow->resetToDefaultSize(); minimap->resetToDefaultSize(); diff --git a/src/gui/setup.h b/src/gui/setup.h index 6601ce3d..77173367 100644 --- a/src/gui/setup.h +++ b/src/gui/setup.h @@ -54,7 +54,7 @@ class Setup : public Window, public gcn::ActionListener * Event handling method. */ void - action(const std::string& eventId, gcn::Widget* widget); + action(const gcn::ActionEvent &event); private: std::list mTabs; diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index db88ff64..e5aadf80 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -46,8 +46,8 @@ Setup_Audio::Setup_Audio(): gcn::Label *sfxLabel = new gcn::Label("Sfx volume"); gcn::Label *musicLabel = new gcn::Label("Music volume"); - mSfxSlider->setEventId("sfx"); - mMusicSlider->setEventId("music"); + mSfxSlider->setActionEventId("sfx"); + mMusicSlider->setActionEventId("music"); mSfxSlider->addActionListener(this); mMusicSlider->addActionListener(this); @@ -108,14 +108,14 @@ void Setup_Audio::cancel() config.setValue("musicVolume", mMusicVolume); } -void Setup_Audio::action(const std::string& event, gcn::Widget *widget) +void Setup_Audio::action(const gcn::ActionEvent &event) { - if (event == "sfx") + if (event.getId() == "sfx") { config.setValue("sfxVolume", (int)mSfxSlider->getValue()); sound.setSfxVolume((int)mSfxSlider->getValue()); } - else if (event == "music") + else if (event.getId() == "music") { config.setValue("musicVolume", (int)mMusicSlider->getValue()); sound.setMusicVolume((int)mMusicSlider->getValue()); diff --git a/src/gui/setup_audio.h b/src/gui/setup_audio.h index f09f62da..6e722f74 100644 --- a/src/gui/setup_audio.h +++ b/src/gui/setup_audio.h @@ -38,7 +38,7 @@ class Setup_Audio : public SetupTab, public gcn::ActionListener void apply(); void cancel(); - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); private: int mMusicVolume, mSfxVolume; diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp index 685d88cf..56f411d7 100644 --- a/src/gui/setup_joystick.cpp +++ b/src/gui/setup_joystick.cpp @@ -45,7 +45,6 @@ Setup_Joystick::Setup_Joystick(): mOriginalJoystickEnabled = (int)config.getValue("joystickEnabled", 0) != 0; mJoystickEnabled->setMarked(mOriginalJoystickEnabled); - mJoystickEnabled->setEventId("joystickEnabled"); mJoystickEnabled->addActionListener(this); add(mCalibrateLabel); @@ -53,13 +52,13 @@ Setup_Joystick::Setup_Joystick(): add(mJoystickEnabled); } -void Setup_Joystick::action(const std::string &event, gcn::Widget *widget) +void Setup_Joystick::action(const gcn::ActionEvent &event) { if (!joystick) { return; } - if (event == "joystickEnabled") + if (event.getSource() == mJoystickEnabled) { joystick->setEnabled(mJoystickEnabled->isMarked()); } diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h index 4cc2b3d9..6d3ad129 100644 --- a/src/gui/setup_joystick.h +++ b/src/gui/setup_joystick.h @@ -38,7 +38,7 @@ class Setup_Joystick : public SetupTab, public gcn::ActionListener void apply(); void cancel(); - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); private: gcn::Label *mCalibrateLabel; diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 7a4aae03..8930af3e 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -158,16 +158,16 @@ Setup_Video::Setup_Video(): mFpsSlider->setEnabled(mFps > 0); mFpsCheckBox->setMarked(mFps > 0); - mCustomCursorCheckBox->setEventId("customcursor"); - mAlphaSlider->setEventId("guialpha"); - mFpsCheckBox->setEventId("fpslimitcheckbox"); - mFpsSlider->setEventId("fpslimitslider"); - mScrollRadiusSlider->setEventId("scrollradiusslider"); - mScrollRadiusField->setEventId("scrollradiusfield"); - mScrollLazinessSlider->setEventId("scrolllazinessslider"); - mScrollLazinessField->setEventId("scrolllazinessfield"); - mOverlayDetailSlider->setEventId("overlaydetailslider"); - mOverlayDetailField->setEventId("overlaydetailfield"); + mCustomCursorCheckBox->setActionEventId("customcursor"); + mAlphaSlider->setActionEventId("guialpha"); + mFpsCheckBox->setActionEventId("fpslimitcheckbox"); + mFpsSlider->setActionEventId("fpslimitslider"); + mScrollRadiusSlider->setActionEventId("scrollradiusslider"); + mScrollRadiusField->setActionEventId("scrollradiusfield"); + mScrollLazinessSlider->setActionEventId("scrolllazinessslider"); + mScrollLazinessField->setActionEventId("scrolllazinessfield"); + mOverlayDetailSlider->setActionEventId("overlaydetailslider"); + mOverlayDetailField->setActionEventId("overlaydetailfield"); mCustomCursorCheckBox->addActionListener(this); mAlphaSlider->addActionListener(this); @@ -331,37 +331,37 @@ void Setup_Video::cancel() config.setValue("opengl", mOpenGLEnabled ? 1 : 0); } -void Setup_Video::action(const std::string &event, gcn::Widget *widget) +void Setup_Video::action(const gcn::ActionEvent &event) { - if (event == "guialpha") + if (event.getId() == "guialpha") { config.setValue("guialpha", mAlphaSlider->getValue()); } - else if (event == "customcursor") + else if (event.getId() == "customcursor") { config.setValue("customcursor", mCustomCursorCheckBox->isMarked() ? 1 : 0); } - else if (event == "fpslimitslider") + else if (event.getId() == "fpslimitslider") { - mFps = (int)mFpsSlider->getValue(); + mFps = (int) mFpsSlider->getValue(); mFpsField->setText(toString(mFps)); } - else if (event == "scrollradiusslider") + else if (event.getId() == "scrollradiusslider") { - int val = (int)mScrollRadiusSlider->getValue(); + int val = (int) mScrollRadiusSlider->getValue(); mScrollRadiusField->setText(toString(val)); config.setValue("ScrollRadius", val); } - else if (event == "scrolllazinessslider") + else if (event.getId() == "scrolllazinessslider") { - int val = (int)mScrollLazinessSlider->getValue(); + int val = (int) mScrollLazinessSlider->getValue(); mScrollLazinessField->setText(toString(val)); config.setValue("ScrollLaziness", val); } - else if (event == "overlaydetailslider") + else if (event.getId() == "overlaydetailslider") { - int val = (int)mOverlayDetailSlider->getValue(); + int val = (int) mOverlayDetailSlider->getValue(); switch (val) { case 0: @@ -376,11 +376,11 @@ void Setup_Video::action(const std::string &event, gcn::Widget *widget) } config.setValue("OverlayDetail", val); } - else if (event == "fpslimitcheckbox") + else if (event.getId() == "fpslimitcheckbox") { if (mFpsCheckBox->isMarked()) { - mFps = (int)mFpsSlider->getValue(); + mFps = (int) mFpsSlider->getValue(); } else { @@ -393,7 +393,8 @@ void Setup_Video::action(const std::string &event, gcn::Widget *widget) } } -void Setup_Video::keyPress(const gcn::Key &key) +void +Setup_Video::keyPressed(gcn::KeyEvent &event) { std::stringstream tempFps(mFpsField->getText()); diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index 482d1c65..095fdbd6 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.h @@ -41,10 +41,11 @@ class Setup_Video : public SetupTab, public gcn::ActionListener, void apply(); void cancel(); - void action(const std::string &eventId, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); /** Called when key is pressed */ - void keyPress(const gcn::Key& key); + void + keyPressed(gcn::KeyEvent &event); private: bool mFullScreenEnabled; diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index 4821067c..8cf0b639 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -125,11 +125,12 @@ void ShopListBox::setSelected(int selected) fireSelectionChangedEvent(); } -void ShopListBox::mousePress(int x, int y, int button) +void ShopListBox::mousePressed(gcn::MouseEvent &event) { - if (button == gcn::MouseInput::LEFT && hasMouse()) + if (event.getButton() == gcn::MouseEvent::LEFT) { bool enoughMoney = false; + int y = event.getY(); if (mShopItems && mPriceCheck) { @@ -145,7 +146,6 @@ void ShopListBox::mousePress(int x, int y, int button) { setSelected(y / mRowHeight); generateAction(); - mMousePressed = true; } } } diff --git a/src/gui/shoplistbox.h b/src/gui/shoplistbox.h index 476564b2..1cfb183b 100644 --- a/src/gui/shoplistbox.h +++ b/src/gui/shoplistbox.h @@ -54,7 +54,7 @@ class ShopListBox : public ListBox */ void draw(gcn::Graphics *graphics); - void mousePress(int x, int y, int button); + void mousePressed(gcn::MouseEvent &event); /** * Adds a listener to the list that's notified each time a change to diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 4f552fd7..1b00a732 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -74,7 +74,7 @@ SkillDialog::SkillDialog(): mUseButton->setEnabled(false); mCloseButton = new Button("Close", "close", this); - mSkillListBox->setEventId("skill"); + mSkillListBox->setActionEventId("skill"); skillScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); skillScrollArea->setDimension(gcn::Rectangle(5, 5, 230, 180)); @@ -103,9 +103,9 @@ SkillDialog::~SkillDialog() cleanList(); } -void SkillDialog::action(const std::string &eventId, gcn::Widget *widget) +void SkillDialog::action(const gcn::ActionEvent &event) { - if (eventId == "inc") + if (event.getId() == "inc") { // Increment skill int selectedSkill = mSkillListBox->getSelected(); @@ -114,13 +114,13 @@ void SkillDialog::action(const std::string &eventId, gcn::Widget *widget) player_node->raiseSkill(mSkillList[selectedSkill]->id); } } - else if (eventId == "skill") + else if (event.getId() == "skill") { mIncButton->setEnabled( mSkillListBox->getSelected() > -1 && player_node->mSkillPoint > 0); } - else if (eventId == "close") + else if (event.getId() == "close") { setVisible(false); } diff --git a/src/gui/skill.h b/src/gui/skill.h index 5555fec4..ed1257b0 100644 --- a/src/gui/skill.h +++ b/src/gui/skill.h @@ -57,7 +57,7 @@ class SkillDialog : public Window, public gcn::ActionListener, */ ~SkillDialog(); - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); void update(); diff --git a/src/gui/status.cpp b/src/gui/status.cpp index bba9f045..9c60752d 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -338,8 +338,10 @@ void StatusWindow::draw(gcn::Graphics *g) Window::draw(g); } -void StatusWindow::action(const std::string &eventId, gcn::Widget *widget) +void StatusWindow::action(const gcn::ActionEvent &event) { + const std::string &eventId = event.getId(); + // Stats Part if (eventId.length() == 3) { diff --git a/src/gui/status.h b/src/gui/status.h index 43dfe8c2..37f8a648 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -51,7 +51,7 @@ class StatusWindow : public Window, public gcn::ActionListener { /** * Called when receiving actions from widget. */ - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); /** * Draw this window diff --git a/src/gui/tabbedcontainer.cpp b/src/gui/tabbedcontainer.cpp index e3d2527b..75f9f3cf 100644 --- a/src/gui/tabbedcontainer.cpp +++ b/src/gui/tabbedcontainer.cpp @@ -78,9 +78,9 @@ void TabbedContainer::logic() Container::logic(); } -void TabbedContainer::action(const std::string &event, gcn::Widget *widget) +void TabbedContainer::action(const gcn::ActionEvent &event) { - std::stringstream ss(event); + std::stringstream ss(event.getId()); int tabNo; ss >> tabNo; diff --git a/src/gui/tabbedcontainer.h b/src/gui/tabbedcontainer.h index 453d8374..2dc017ae 100644 --- a/src/gui/tabbedcontainer.h +++ b/src/gui/tabbedcontainer.h @@ -43,7 +43,7 @@ class TabbedContainer : public gcn::Container, public gcn::ActionListener void logic(); - void action(const std::string &event, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); void setOpaque(bool opaque); diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 82262563..14b1afa6 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -256,11 +256,11 @@ void TradeWindow::selectionChanged(const SelectionEvent &event) } } -void TradeWindow::action(const std::string &eventId, gcn::Widget *widget) +void TradeWindow::action(const gcn::ActionEvent &event) { Item *item = inventoryWindow->getItem(); - if (eventId == "add") + if (event.getId() == "add") { if (!item) { @@ -286,14 +286,14 @@ void TradeWindow::action(const std::string &eventId, gcn::Widget *widget) new ItemAmountWindow(AMOUNT_TRADE_ADD, this, item); } } - else if (eventId == "cancel") + else if (event.getId() == "cancel") { // XXX Convert for new server /* MessageOut outMsg(CMSG_TRADE_CANCEL_REQUEST); */ } - else if (eventId == "ok") + else if (event.getId() == "ok") { std::stringstream tempMoney(mMoneyField->getText()); int tempInt; @@ -317,7 +317,7 @@ void TradeWindow::action(const std::string &eventId, gcn::Widget *widget) MessageOut outMsg(CMSG_TRADE_ADD_COMPLETE); */ } - else if (eventId == "trade") + else if (event.getId() == "trade") { // XXX Convert for new server /* diff --git a/src/gui/trade.h b/src/gui/trade.h index ebd05a52..1c64c255 100644 --- a/src/gui/trade.h +++ b/src/gui/trade.h @@ -111,7 +111,7 @@ class TradeWindow : public Window, gcn::ActionListener, SelectionListener /** * Called when receiving actions from the widgets. */ - void action(const std::string &eventId, gcn::Widget *widget); + void action(const gcn::ActionEvent &event); private: typedef std::auto_ptr InventoryPtr; diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 73e4489e..d41dfe13 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -132,9 +132,9 @@ void UpdaterWindow::enable() mPlayButton->requestFocus(); } -void UpdaterWindow::action(const std::string &eventId, gcn::Widget *widget) +void UpdaterWindow::action(const gcn::ActionEvent &event) { - if (eventId == "cancel") + if (event.getId() == "cancel") { // Register the user cancel mUserCancel=true; @@ -148,7 +148,7 @@ void UpdaterWindow::action(const std::string &eventId, gcn::Widget *widget) mDownloadStatus = UPDATE_ERROR; } } - else if (eventId == "play") + else if (event.getId() == "play") { state = STATE_LOGIN; } diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h index 0d1493ee..8c54be27 100644 --- a/src/gui/updatewindow.h +++ b/src/gui/updatewindow.h @@ -79,7 +79,7 @@ class UpdaterWindow : public Window, public gcn::ActionListener */ void loadNews(); - void action(const std::string& eventId, gcn::Widget* widget); + void action(const gcn::ActionEvent &event); void logic(); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 75a16865..671ababa 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -47,6 +47,7 @@ Viewport::Viewport(): mCameraX(0), mCameraY(0), mShowDebugPath(false), + mPlayerFollowMouse(false), mPopupActive(false) { setOpaque(false); @@ -243,7 +244,7 @@ Viewport::logic() } void -Viewport::mousePress(int mx, int my, int button) +Viewport::mousePressed(gcn::MouseEvent &event) { // Check if we are alive and kickin' if (!mMap || !player_node || player_node->mAction == Being::DEAD) @@ -255,11 +256,11 @@ Viewport::mousePress(int mx, int my, int button) mPlayerFollowMouse = false; - int tilex = (mx + mCameraX) / 32; - int tiley = (my + mCameraY) / 32; + int tilex = (event.getX() + mCameraX) / 32; + int tiley = (event.getY() + mCameraY) / 32; // Right click might open a popup - if (button == gcn::MouseInput::RIGHT) + if (event.getButton() == gcn::MouseEvent::RIGHT) { Being *being; FloorItem *floorItem; @@ -267,12 +268,12 @@ Viewport::mousePress(int mx, int my, int button) if ((being = beingManager->findBeing(tilex, tiley)) && being->getType() != Being::LOCALPLAYER) { - showPopup(mx, my, being); + showPopup(event.getX(), event.getY(), being); return; } else if((floorItem = floorItemManager->findByCoordinates(tilex, tiley))) { - showPopup(mx, my, floorItem); + showPopup(event.getX(), event.getY(), floorItem); return; } } @@ -286,7 +287,7 @@ Viewport::mousePress(int mx, int my, int button) } // Left click can cause different actions - if (button == gcn::MouseInput::LEFT) + if (event.getButton() == gcn::MouseEvent::LEFT) { FloorItem *item; @@ -302,13 +303,13 @@ Viewport::mousePress(int mx, int my, int button) Uint8 *keys = SDL_GetKeyState(NULL); if (!(keys[SDLK_LSHIFT] || keys[SDLK_RSHIFT])) { - player_node->setDestination(mx + mCameraX, my + mCameraY); + player_node->setDestination(event.getX() + mCameraX, + event.getY() + mCameraY); } mPlayerFollowMouse = true; } } - - if (button == gcn::MouseInput::MIDDLE) + else if (event.getButton() == gcn::MouseEvent::MIDDLE) { // Find the being nearest to the clicked position Being *target = beingManager->findNearestLivingBeing( @@ -323,19 +324,20 @@ Viewport::mousePress(int mx, int my, int button) } void -Viewport::mouseMotion(int mx, int my) +Viewport::mouseMoved(gcn::MouseEvent &event) { if (!mMap || !player_node) return; if (mPlayerFollowMouse && mWalkTime == player_node->mWalkTime) { - player_node->setDestination(mx + mCameraX, my + mCameraY); + player_node->setDestination(event.getX() + mCameraX, + event.getY() + mCameraY); } } void -Viewport::mouseRelease(int mx, int my, int button) +Viewport::mouseReleased(gcn::MouseEvent &event) { mPlayerFollowMouse = false; } diff --git a/src/gui/viewport.h b/src/gui/viewport.h index df78b1da..80475fbf 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -79,31 +79,33 @@ class Viewport : public WindowContainer, public gcn::MouseListener, /** * Toggles whether the path debug graphics are shown */ - void toggleDebugPath() { mShowDebugPath = !mShowDebugPath; } + void + toggleDebugPath() { mShowDebugPath = !mShowDebugPath; } /** * Handles mouse press on map. */ void - mousePress(int mx, int my, int button); + mousePressed(gcn::MouseEvent &event); /** * Handles mouse move on map */ void - mouseMotion(int mx, int my); + mouseMoved(gcn::MouseEvent &event); /** * Handles mouse button release on map. */ void - mouseRelease(int mx, int my, int button); + mouseReleased(gcn::MouseEvent &event); /** * Shows a popup for an item. * TODO Find some way to get rid of Item here */ - void showPopup(int x, int y, Item *item); + void + showPopup(int x, int y, Item *item); /** * A relevant config option changed. @@ -111,6 +113,18 @@ class Viewport : public WindowContainer, public gcn::MouseListener, void optionChanged(const std::string &name); + /** + * Returns camera x offset in tiles. + */ + int + getCameraX() { return mCameraX; } + + /** + * Returns camera y offset in tiles. + */ + int + getCameraY() { return mCameraY; } + private: /** * Shows a popup for a floor item. @@ -131,8 +145,8 @@ class Viewport : public WindowContainer, public gcn::MouseListener, int mScrollLaziness; float mViewX; /**< Current viewpoint in pixels. */ float mViewY; /**< Current viewpoint in pixels. */ - int mCameraX; - int mCameraY; + int mCameraX; /**< Current viewpoint in tiles. */ + int mCameraY; /**< Current viewpoint in tiles. */ bool mShowDebugPath; /**< Show a path from player to pointer. */ bool mPlayerFollowMouse; diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 1960d6ca..bb60c6ff 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -197,6 +197,12 @@ void Window::setContentHeight(int height) resizeToContent(); } +void Window::setContentSize(int width, int height) +{ + setContentWidth(width); + setContentHeight(height); +} + void Window::setLocationRelativeTo(gcn::Widget *widget) { int wx, wy; @@ -209,12 +215,6 @@ void Window::setLocationRelativeTo(gcn::Widget *widget) getY() + (wy + (widget->getHeight() - getHeight()) / 2 - y)); } -void Window::setContentSize(int width, int height) -{ - setContentWidth(width); - setContentHeight(height); -} - void Window::setMinWidth(unsigned int width) { mMinWinWidth = width; @@ -282,86 +282,60 @@ void Window::add(gcn::Widget *w, int x, int y, bool delChild) mChrome->add(w, x, y, delChild); } -void Window::mousePress(int x, int y, int button) +void Window::mousePressed(gcn::MouseEvent &event) { // Let Guichan move window to top and figure out title bar drag - gcn::Window::mousePress(x, y, button); + gcn::Window::mousePressed(event); - // If the mouse is not inside the content, the press must have been on the - // border, and is a candidate for a resize. - if (isResizable() && button == 1 && + int x = event.getX(); + int y = event.getY(); + + // Activate resizing if the left mouse button was pressed on the grip + mMouseResize = + isResizable() && + event.getButton() == gcn::MouseEvent::LEFT && getGripDimension().isPointInRect(x, y) && - !getChildrenArea().isPointInRect(x, y) && - hasMouse() && - !(mMouseDrag && y > (int)getPadding())) - { - mMouseResize = true; - mMouseXOffset = x; - mMouseYOffset = y; - } + !getChildrenArea().isPointInRect(x, y); } -void Window::mouseMotion(int x, int y) +void Window::mouseDragged(gcn::MouseEvent &event) { - if (mMouseDrag || mMouseResize) + // Let Guichan handle title bar drag + gcn::Window::mouseDragged(event); + + // Keep guichan window inside screen + int newX = std::max(0, getX()); + int newY = std::max(0, getY()); + newX = std::min(windowContainer->getWidth() - getWidth(), newX); + newY = std::min(windowContainer->getHeight() - getHeight(), newY); + setPosition(newX, newY); + + if (mMouseResize && !mIsMoving) { - int dx = x - mMouseXOffset; - int dy = y - mMouseYOffset; gcn::Rectangle newDim = getDimension(); - // Change the dimension according to dragging and moving - if (mMouseResize && isResizable()) - { - // We're dragging bottom right - newDim.height += dy; - newDim.width += dx; - } - else if (mMouseDrag && isMovable()) - { - newDim.x += dx; - newDim.y += dy; - } + // We're dragging bottom right + newDim.width += event.getX() - mDragOffsetX; + newDim.height += event.getY() - mDragOffsetY; - // Keep guichan window inside screen + // Keep guichan window inside screen (supports resizing any side) if (newDim.x < 0) { - if (mMouseResize) - { - newDim.width += newDim.x; - } - + newDim.width += newDim.x; newDim.x = 0; } if (newDim.y < 0) { - if (mMouseResize) - { - newDim.height += newDim.y; - } - + newDim.height += newDim.y; newDim.y = 0; } if (newDim.x + newDim.width > windowContainer->getWidth()) { - if (mMouseResize) - { - newDim.width = windowContainer->getWidth() - newDim.x; - } - else - { - newDim.x = windowContainer->getWidth() - newDim.width; - } + newDim.width = windowContainer->getWidth() - newDim.x; } if (newDim.y + newDim.height > windowContainer->getHeight()) { - if (mMouseResize) - { - newDim.height = windowContainer->getHeight() - newDim.y; - } - else - { - newDim.y = windowContainer->getHeight() - newDim.height; - } + newDim.height = windowContainer->getHeight() - newDim.y; } // Keep the window at least its minimum size @@ -383,18 +357,9 @@ void Window::mouseMotion(int x, int y) newDim.height = mMaxWinHeight; } - // Snap window to edges - //if (x < snapSize) x = 0; - //if (y < snapSize) y = 0; - //if (x + winWidth + snapSize > screen->w) x = screen->w - winWidth; - //if (y + winHeight + snapSize > screen->h) y = screen->h - winHeight; - // Update mouse offset when dragging bottom or right border - if (mMouseResize) - { - mMouseYOffset += newDim.height - getHeight(); - mMouseXOffset += newDim.width - getWidth(); - } + mDragOffsetX += newDim.width - getWidth(); + mDragOffsetY += newDim.height - getHeight(); // Set the new window and content dimensions setDimension(newDim); @@ -403,16 +368,6 @@ void Window::mouseMotion(int x, int y) } } -void -Window::mouseRelease(int x, int y, int button) -{ - if (button == 1) - { - mMouseResize = false; - mMouseDrag = false; - } -} - gcn::Rectangle Window::getGripDimension() { diff --git a/src/gui/window.h b/src/gui/window.h index 158035c0..9ac02287 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -77,12 +77,12 @@ class Window : public gcn::Window /** * Adds a widget to the window. */ - void add(gcn::Widget *wi, bool delChild=true); + void add(gcn::Widget *wi, bool delChild = true); /** * Adds a widget to the window and also specifices its position. */ - void add(gcn::Widget *w, int x, int y, bool delChild=true); + void add(gcn::Widget *w, int x, int y, bool delChild = true); /** * Sets the width of the window contents. @@ -95,14 +95,14 @@ class Window : public gcn::Window void setContentHeight(int height); /** - * Sets the location relative to the given widget. + * Sets the size of this window. */ - void setLocationRelativeTo(gcn::Widget* widget); + void setContentSize(int width, int height); /** - * Sets the size of this window. + * Sets the location relative to the given widget. */ - void setContentSize(int width, int height); + void setLocationRelativeTo(gcn::Widget *widget); /** * Sets whether of not the window can be resized. @@ -146,7 +146,7 @@ class Window : public gcn::Window */ bool isSticky(); - /** + /** * Overloads window setVisible by guichan to allow sticky window * Handling */ @@ -171,9 +171,8 @@ class Window : public gcn::Window * Window dragging and resizing mouse related. These methods also makes * sure the window is not dragged/resized outside of the screen. */ - void mousePress(int x, int y, int button); - void mouseMotion(int mx, int my); - void mouseRelease(int x, int y, int button); + void mousePressed(gcn::MouseEvent &event); + void mouseDragged(gcn::MouseEvent &event); /** * Gets the position of the resize grip. diff --git a/src/main.cpp b/src/main.cpp index b9eeaeb5..3a448494 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -110,7 +110,8 @@ Net::Connection *chatServerConnection = 0; namespace { struct ErrorListener : public gcn::ActionListener { - void action(const std::string &eventId, gcn::Widget *widget) { + void action(const gcn::ActionEvent &event) + { state = STATE_CHOOSE_SERVER; } } errorListener; @@ -713,15 +714,16 @@ int main(int argc, char *argv[]) logger->log("State: CHAR_SELECT"); currentDialog = new CharSelectDialog(&charInfo); - if (((CharSelectDialog*)currentDialog)-> + if (((CharSelectDialog*) currentDialog)-> selectByName(options.playername)) options.chooseDefault = true; else - ((CharSelectDialog*)currentDialog)->selectByName( + ((CharSelectDialog*) currentDialog)->selectByName( config.getValue("lastCharacter", "")); if (options.chooseDefault) - ((CharSelectDialog*)currentDialog)->action("ok", NULL); + ((CharSelectDialog*) currentDialog)->action( + gcn::ActionEvent(NULL, "ok")); break; case STATE_ERROR: diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp index f16037cf..327edea3 100644 --- a/src/net/playerhandler.cpp +++ b/src/net/playerhandler.cpp @@ -56,7 +56,7 @@ extern Window *buySellDialog; namespace { struct WeightListener : public gcn::ActionListener { - void action(const std::string &eventId, gcn::Widget *widget) + void action(const gcn::ActionEvent &event) { weightNotice = NULL; } @@ -70,7 +70,7 @@ namespace { namespace { struct DeathListener : public gcn::ActionListener { - void action(const std::string &eventId, gcn::Widget *widget) + void action(const gcn::ActionEvent &event) { player_node->revive(); deathNotice = NULL; diff --git a/src/net/tradehandler.cpp b/src/net/tradehandler.cpp index 2ebc160f..b3e80675 100644 --- a/src/net/tradehandler.cpp +++ b/src/net/tradehandler.cpp @@ -41,9 +41,9 @@ std::string tradePartnerName; namespace { struct RequestTradeListener : public gcn::ActionListener { - void action(const std::string &eventId, gcn::Widget *widget) + void action(const gcn::ActionEvent &event) { - player_node->tradeReply(eventId == "yes"); + player_node->tradeReply(event.getId() == "yes"); }; } listener; } diff --git a/tools/Purger.java b/tools/Purger.java deleted file mode 100644 index 1751c8de..00000000 --- a/tools/Purger.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Purger (c) 2006 Eugenio Favalli - * License: GPL, v2 or later - */ - -import java.io.*; -import java.text.*; -import java.util.*; - - public class Purger { - - public static void main(String[] args) { - if (args.length != 2) { - System.out.println( - "Usage: java Purger \n" + - " - folder: is the path to account.txt and athena.txt files.\n" + - " - date: accounts created before this date will be purged (dd/mm/yy)."); - return; - } - - int accounts = 0; - int characters = 0; - int deletedCharacters = 0; - Vector activeAccounts = new Vector(); - - File oldAccount = new File(args[0] + "account.txt"); - File oldAthena = new File(args[0] + "athena.txt"); - File newAccount = new File(args[0] + "account.txt.new"); - File newAthena = new File(args[0] + "athena.txt.new"); - - DateFormat dateFormat = new SimpleDateFormat("dd/MM/yy"); - Date purgeDate; - try { - purgeDate = dateFormat.parse(args[1]); - } - catch (ParseException e) { - System.out.println("ERROR: Wrong date format."); - return; - } - - String line; - try { - FileInputStream fin = new FileInputStream(oldAccount); - BufferedReader input = new BufferedReader( - new InputStreamReader(fin)); - FileOutputStream fout = new FileOutputStream(newAccount); - PrintStream output = new PrintStream(fout); - - while ((line = input.readLine()) != null) { - boolean copy = false; - String[] fields = line.split("\t"); - // Check if we're reading a comment or the last line - if (line.substring(0, 2).equals("//") || fields[1].charAt(0) == '%') { - copy = true; - } - else { - // Server accounts should not be purged - if (!fields[4].equals("S")) { - accounts++; - dateFormat = new SimpleDateFormat("yyyy-MM-dd"); - try { - Date date = dateFormat.parse(fields[3]); - if (date.after(purgeDate)) { - activeAccounts.add(fields[0]); - copy = true; - } - } - catch (ParseException e) { - System.out.println( - "ERROR: Wrong date format in account.txt. (" - + accounts + ": " + line + ")"); - //return; - } - catch (Exception e) { - e.printStackTrace(); - return; - } - } - else { - copy = true; - } - } - if (copy) { - try { - output.println(line); - } - catch (Exception e) { - System.err.println("ERROR: Unable to write file."); - } - } - } - } - catch (FileNotFoundException e ) { - System.out.println( - "ERROR: file " + oldAccount.getAbsolutePath() + " not found."); - return; - } - catch (Exception e) { - System.out.println("ERROR: unable to process account.txt"); - e.printStackTrace(); - return; - } - - input.close(); - output.close(); - - try { - FileInputStream fin = new FileInputStream(oldAthena); - BufferedReader input = new BufferedReader( - new InputStreamReader(fin)); - FileOutputStream fout = new FileOutputStream(newAthena); - PrintStream output = new PrintStream(fout); - - while ((line = input.readLine()) != null) { - boolean copy = false; - String[] fields = line.split("\t"); - // Check if we're reading a comment or the last line - if (line.substring(0, 2).equals("//") - || fields[1].charAt(0) == '%') { - copy = true; - } - else { - characters++; - String id = fields[1].substring(0, fields[1].indexOf(',')); - if (activeAccounts.contains(id)) { - copy = true; - } - else { - deletedCharacters++; - } - } - if (copy) { - output.println(line); - } - } - } - catch (FileNotFoundException e ) { - System.out.println( - "ERROR: file " + oldAthena.getAbsolutePath() + " not found."); - return; - } - catch (Exception e) { - System.out.println("ERROR: unable to process athena.txt"); - e.printStackTrace(); - return; - } - - input.close(); - output.close(); - - System.out.println( - "Removed " + (accounts - activeAccounts.size()) + "/" + - accounts + " accounts."); - System.out.println( - "Removed " + deletedCharacters + "/" - + characters + " characters."); - } - -} \ No newline at end of file -- cgit v1.2.3-70-g09d2 From a353543dd4da3c489a84f6f17125fdd0e1be2349 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 4 Jun 2007 21:48:47 +0000 Subject: Merged 0.0 changes from revision 3234 to 3317 to trunk. --- ChangeLog | 465 ++++++++++++++++++++++++++++- NEWS | 16 + README | 3 +- data/graphics/gui/CMakeLists.txt | 8 +- data/graphics/gui/Makefile.am | 6 + data/graphics/gui/target-cursor-blue-l.png | Bin 0 -> 23803 bytes data/graphics/gui/target-cursor-blue-m.png | Bin 0 -> 18439 bytes data/graphics/gui/target-cursor-blue-s.png | Bin 0 -> 8353 bytes data/graphics/gui/target-cursor-blue.png | Bin 8353 -> 0 bytes data/graphics/gui/target-cursor-red-l.png | Bin 0 -> 25586 bytes data/graphics/gui/target-cursor-red-m.png | Bin 0 -> 17950 bytes data/graphics/gui/target-cursor-red-s.png | Bin 0 -> 8361 bytes data/graphics/gui/target-cursor-red.png | Bin 8361 -> 0 bytes data/help/changes.txt | 147 ++++----- data/help/header.txt | 2 +- docs/Makefile.am | 3 +- src/CMakeLists.txt | 14 + src/Makefile.am | 16 +- src/animatedsprite.cpp | 24 ++ src/animatedsprite.h | 12 + src/animationparticle.cpp | 51 ++++ src/animationparticle.h | 49 +++ src/being.cpp | 122 +++++--- src/being.h | 36 ++- src/engine.cpp | 7 + src/game.cpp | 24 +- src/graphics.cpp | 2 - src/gui/buy.cpp | 117 +++----- src/gui/buy.h | 6 + src/gui/chat.cpp | 4 +- src/gui/chat.h | 4 +- src/gui/debugwindow.cpp | 10 + src/gui/debugwindow.h | 1 + src/gui/inventorywindow.cpp | 7 +- src/gui/sell.cpp | 159 +++++----- src/gui/sell.h | 6 + src/gui/updatewindow.cpp | 7 +- src/gui/viewport.cpp | 108 ++++--- src/gui/viewport.h | 20 +- src/gui/widgets/resizegrip.cpp | 65 ++++ src/gui/widgets/resizegrip.h | 61 ++++ src/gui/window.cpp | 185 ++++++++---- src/gui/window.h | 66 ++-- src/imageparticle.cpp | 69 +++++ src/imageparticle.h | 61 ++++ src/main.cpp | 26 +- src/map.cpp | 23 ++ src/map.h | 25 +- src/monster.cpp | 6 + src/monster.h | 3 + src/net/beinghandler.cpp | 17 +- src/openglgraphics.cpp | 24 +- src/particle.cpp | 370 +++++++++++++++++++++++ src/particle.h | 288 ++++++++++++++++++ src/particleemitter.cpp | 327 ++++++++++++++++++++ src/particleemitter.h | 120 ++++++++ src/resources/animation.h | 2 +- src/resources/image.cpp | 25 +- src/resources/mapreader.cpp | 24 ++ src/resources/monsterdb.cpp | 21 ++ src/resources/monsterinfo.h | 14 +- src/simpleanimation.cpp | 85 ++++++ src/simpleanimation.h | 15 +- src/sprite.h | 16 + src/textparticle.cpp | 64 ++++ src/textparticle.h | 53 ++++ src/utils/fastsqrt.h | 24 ++ src/utils/minmax.h | 47 +++ src/utils/wingettimeofday.h | 226 +++++++------- src/utils/xml.cpp | 23 ++ src/utils/xml.h | 11 + 71 files changed, 3240 insertions(+), 602 deletions(-) create mode 100644 data/graphics/gui/target-cursor-blue-l.png create mode 100644 data/graphics/gui/target-cursor-blue-m.png create mode 100644 data/graphics/gui/target-cursor-blue-s.png delete mode 100644 data/graphics/gui/target-cursor-blue.png create mode 100644 data/graphics/gui/target-cursor-red-l.png create mode 100644 data/graphics/gui/target-cursor-red-m.png create mode 100644 data/graphics/gui/target-cursor-red-s.png delete mode 100644 data/graphics/gui/target-cursor-red.png create mode 100644 src/animationparticle.cpp create mode 100644 src/animationparticle.h create mode 100644 src/gui/widgets/resizegrip.cpp create mode 100644 src/gui/widgets/resizegrip.h create mode 100644 src/imageparticle.cpp create mode 100644 src/imageparticle.h create mode 100644 src/particle.cpp create mode 100644 src/particle.h create mode 100644 src/particleemitter.cpp create mode 100644 src/particleemitter.h create mode 100644 src/textparticle.cpp create mode 100644 src/textparticle.h create mode 100644 src/utils/fastsqrt.h create mode 100644 src/utils/minmax.h (limited to 'src/gui/buy.h') diff --git a/ChangeLog b/ChangeLog index 61aef963..63aaa1eb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,162 @@ +2007-06-03 David Athay + + * src/main.cpp, src/game.cpp: Fixed screenshot taking on OSX. + +2007-06-03 Bjørn Lindeijer + + * src/CMakeLists.txt, src/Makefile.am, docs/Makefile.am: Added some + files to be included with the release. + * src/utils/fastsqrt.h: Fixed warning about strict-aliasing rules. + * src/Makefile.am: Don't die on warnings by default. + * src/resources/image.cpp: Fixed image loading in software mode to not + check for alpha layer when images aren't 32-bit. + * src/graphics.cpp, src/graphics.h, src/imageparticle.cpp: Removed + drawImageTransparent from Graphics class, should be set on image. + * src/imageparticle.h, src/particleemitter.h, src/particle.h, + src/particleemitter.cpp, src/particle.cpp, src/imageparticle.cpp: Have + ParticleEmitter load a possible particle image early on and don't + cause a crash when the image can't be found. + +2007-06-02 Bjørn Lindeijer + + * src/winver.h, README, NEWS, CMakeLists.txt, configure.ac, + data/help/changes.txt, data/help/header.txt: Updated version and + release date and summarized changes. + * src/gui/chat.h, src/gui/chat.cpp: Changed color of chat messages in + OpenGL mode from orange to black. + * src/gui/sell.cpp, src/gui/buy.h, src/gui/buy.cpp, src/gui/sell.h: + Some cleanup of buy/sell dialog code. + +2007-06-01 Bjørn Lindeijer + + * data/graphics/gui/CMakeLists.txt, data/graphics/gui/Makefile.am: + Added target cursors to installed files. + +2007-05-31 Philipp Sehmisch + + * data/maps/new_16-1.tmx.gz: Fixed an inconsistency with the neighbor + map (no new walkmap required). + +2007-05-23 Bjørn Lindeijer + + * src/gui/sell.cpp, src/gui/buy.cpp, src/being.cpp: A bunch of + lingering syntactical changes. + * src/gui/viewport.cpp: Added a missing include and fixed a bug with + cleaning up target cursor animations. + +2007-05-23 Philipp Sehmisch + + * src/gui/viewport.cpp, + data/graphics/gui/target-cursor-blue-s.png, + data/graphics/gui/target-cursor-blue-m.png, + data/graphics/gui/target-cursor-blue-l.png, + data/graphics/gui/target-cursor-red-s.png, + data/graphics/gui/target-cursor-red-m.png, + data/graphics/gui/target-cursor-red-l.png: Replaced target cursor + graphics with higher quality ones by Pauan. + * src/particle.cpp: Made bouncing particles immune against death by + ground contact and removed a nonsensical debugging log message. Made + text splash effects fade out. + * src/textparticle.cpp: Implemented fading in and out for text + particles. + * src/being.cpp, src/particle.cpp, src/particle.h, + src/textparticle.cpp, src/textparticle.h: The color values of text + particles are now stored in 3 integers instead of a Guichan color + structure. + +2007-05-20 Eugenio Favalli + + * tmw.cbp: Updated Code::Blocks project file. + +2007-05-20 Philipp Sehmisch + + * src/gui/buy.cpp, src/gui/sell.cpp: Unified some differences between + buy and sell dialog. Money label now shows money after transaction + instead of current money. + * src/gui/sell.cpp: Fixed the amount-not-reset-when-using-scrollwheel + bug. + * src/being.h, src/gui/viewport.cpp, src/gui/viewport.h: Added 3 + different target cursor sizes. + * src/monster.h, src/monster.cpp, src/resources/monsterdb.cpp, + scr/resources/monsterinfo.h, data/monsters.xml: Target cursor size for + monster is read from the monsters.xml. + * data/graphics/gui/target-cursor-blue-s.png, + data/graphics/gui/target-cursor-blue-m.png, + data/graphics/gui/target-cursor-blue-l.png, + data/graphics/gui/target-cursor-red-s.png, + data/graphics/gui/target-cursor-red-m.png, + data/graphics/gui/target-cursor-red-l.png: Added temporary + placeholders for small and large target cursors until better versions + based on the original SVG are available. + +2007-05-08 Philipp Sehmisch + + * data/graphics/sprites/monster-bat.png, + data/graphics/sprites/monster-bat.xml, + data/graphics/sprites/monster-flower.xml, + data/graphics/sprites/monster-fluffy.xml, + data/graphics/sprites/monster-fluffy.png, + data/graphics/sprites/monster-goblin-fire.xml, + data/graphics/sprites/monster-maggot-giant.xml, + data/graphics/sprites/monster-maggot.xml, + data/graphics/sprites/monster-mountsnake.xml, + data/graphics/sprites/monster-mushroom-red.xml, + data/graphics/sprites/monster-mushroom-spiky.xml, + data/graphics/sprites/monster-pinkie.xml, + data/graphics/sprites/monster-scorpion-black.xml, + data/graphics/sprites/monster-scorpion-red.png, + data/graphics/sprites/monster-scorpion-red.xml, + data/graphics/sprites/monster-skull-poison.xml, + data/graphics/sprites/monster-slime-green.xml, + data/graphics/sprites/monster-slime-red.xml, + data/graphics/sprites/monster-slime-rudolph.xml, + data/graphics/sprites/monster-slime-santa.png, + data/graphics/sprites/monster-slime-santa.xml, + data/graphics/sprites/monster-slime-yellow.xml, + data/graphics/sprites/monster-snake-cave.png, + data/graphics/sprites/monster-snake-cave.xml, + data/graphics/sprites/monster-snake.xml, + data/graphics/sprites/monster-spider.xml: + Adjusted offsets of monster sprites (thanks to Pauan for finding out + the correct offsets - I just subtracted 6 of all x offsets to take the + new position of the target circle in account) and committed some + modifications at some monster graphics by Pauan. + +2007-05-02 Philipp Sehmisch + + * src/sprite.h, src/being.cpp, src/being.h, src/animatedsprite.cpp, + src/animatedsprite.h: Added methods to get the width and height of the + graphical representation of a sprite. + * src/gui/viewport.cpp: Fixed positioning of monster names and target + circles. + +2007-05-02 Philipp Sehmisch + + * src/particle.cpp: Fixed a compiler warning. + +2007-05-02 Björn Steinbrink + + * src/Makefile.am: Add the new particle subclasses to the automake + configuration. + * src/imageparticle.h, src/textparticle.h, src/particle.h, + src/animationparticle.h, src/CMakeLists.txt, src/particleemitter.cpp, + src/animationparticle.cpp, src/particle.cpp, src/imageparticle.cpp, + src/textparticle.cpp, src/utils/xml.cpp, src/utils/xml.h: Split the + particle class into subclasses based on their appearance. + +2007-04-24 Philipp Sehmisch + + * src/particle.cpp, src/particle.h: Some minor code cleanups, speed + optimizations and a bit of documentation. + +2007-04-23 Philipp Sehmisch + + * data/graphics/particles/flame.particle.xml, + data/graphics/particles/blaze.png: Added two files I forgot with the + last commit. + * src/resources/mapreader.cpp, src/particle.cpp, + src/particleemitter.cpp: Using XML child node iteration macro. + 2007-04-22 Björn Steinbrink * CMake/Modules/FindENet.cmake: Fixed ENet status always being set to @@ -10,11 +169,74 @@ * src/resources/itemdb.cpp: Made the parameter checks more terse and manageable. +2007-04-19 Philipp Sehmisch + + * src/resources/mapreader.cpp: Emitter positions are now read from map + files. + * src/engine.cpp: Removed the player follow effect used for testing. + * data/maps/new_4-1.tmx.gz, data/maps/new_5-1.tmx.gz: Added flame + effect to all lamps on the cave maps + * data/maps/new_9-1.tmx.gz: Added waterfall effect to the upper right + corner of NW woodland map. + +2007-04-15 Bjørn Lindeijer + + * src/openglgraphics.cpp: Rely on default 0 value for z axis. + * src/CMakeLists.txt, src/gui/window.cpp, src/gui/widgets, + src/gui/widgets/resizegrip.cpp, src/gui/widgets/resizegrip.h, + src/gui/inventorywindow.cpp, src/gui/window.h, src/Makefile.am: + Reimplemented window resizing. It is now once again possible to resize + windows using their borders (except for the top one, since that's the + title bar for Guichan) and the resize grip in the bottom right is much + easier to grab. + * src/gui/window.cpp: Increased minimum window height and fixed a + problem with setting window content size which was introduced with the + new resize grip. + 2007-04-13 Björn Steinbrink * data/graphics/gui/CMakeLists.txt: Added target cursor graphics to the set of files to be installed. +2007-04-05 Eugenio Favalli + + * src/main.cpp: Unified storage of configuration, updates and + screenshots in home directory. + +2007-04-03 Philipp Sehmisch + + * data/graphics/items/generic-easteregg-blue.png, + data/graphics/items/generic-easteregg-green.png, + data/graphics/items/generic-easteregg-pink.png, + data/graphics/items/generic-easteregg-red.png, + data/graphics/items/generic-easteregg-teal.png, + data/graphics/items/generic-easteregg-yellow.png, + data/items.xml: Added six different easter egg item graphics for the + easter event. Item IDs are 1208 - 1213. + * data/graphics/sprites/npcs.png: Added bunny girl npc for the easter + event. + +2007-04-01 Philipp Sehmisch + + * src/game.cpp: Screenshots are no longer saved directly in the users + home directory on UNIX systems but in the sub folder /.tmw/. A chatlog + message about the success of the screenshot saving does appear now. + Based on a patch by Patrick "the-me" Matthäi. + +2007-03-27 Bjørn Lindeijer + + * src/main.cpp: Icon loading doesn't necessarily succeed, so better + not crash when it doesn't. + +2007-03-25 Philipp Sehmisch + + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Improved programming style and documentation + and added some small tweaks. + * src/engine.cpp, src/map.cpp, src/map.h, src/resources/mapreader.cpp: + Prepared getting the emitter positions from the map file by storing + them in the Map class and setting them up from the MapReader. + 2007-03-24 Bjørn Lindeijer * src/main.cpp: Changed the order of network message handling and @@ -49,6 +271,16 @@ src/net/charserverhandler.h, src/net/charserverhandler.cpp: Made sure the character creation dialog doesn't close when creation failed. +2007-03-22 Philipp Sehmisch + + * src/simpleanimation.cpp, src/simpleanimation.h: Added new + constructor for simple animation that allows to build the animation + based on an xmlNodePtr pointing to an node. + * src/particle.cpp, src/particle.h: Added support for and + childtags for effect root particles. + * data/graphics/particles/playerglow.particle.xml: New player follow + effect that demonstrates an animated root particle with an emitter. + 2007-03-22 Bjørn Lindeijer * src/gui/login.cpp, src/gui/login.h, src/gui/register.h, @@ -84,6 +316,11 @@ src/resources/resourcemanager.cpp, src/resources/spriteset.cpp, src/resources/spritedef.h: Renamed Spriteset to ImageSet. +2007-03-20 Philipp Sehmisch + + * src/gui/updatewindow.cpp: Cancel button is now disabled after + downloading is finished. + 2007-03-20 David Athay * src/gui/viewport.cpp: Fixed target cursor animation, and changed @@ -160,6 +397,8 @@ * src/simpleanimation.cpp, src/simpleanimation.h, src/CmakeLists.txt, src/Makefile.am: Added a simple animation class that hosts a looping animation without the action and direction stuff from AnimatedSprite. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp: Used said + simple animation class for animated particles. 2007-03-12 Bjørn Lindeijer @@ -171,6 +410,14 @@ * src/map.cpp, src/gui/viewport.cpp: Fixed a bug that made the engine not draw the last row and column of the map. +2007-03-09 Philipp Sehmisch + + * src/particle.cpp: Reimplemented physics mode that uses the default + square root function as fallback for systems where the fastInvSqrt + function doesn't work properly. + * src/particle.cpp, src/particle.h: Some performance optimizations + suggested by Rogier "Avaniel" Polak. + 2007-03-09 Bjørn Lindeijer * data/graphics/gui/target-cursor-blue.png, @@ -221,6 +468,10 @@ data/sfx/pinkie-hit1.ogg, data/sfx/pinkie-miss1.ogg, data/monsters.xml: New sound effects by Cosmostrator. +2007-02-25 Philipp Sehmisch + + * src/particle.h, src/particleemitter.h: Just some documentation work. + 2007-02-25 Bjørn Lindeijer * src/CMakeLists.txt: Updated CMake file. @@ -247,6 +498,12 @@ size and data type. * src/logindata.h: Added a clear function. +2007-02-22 Philipp Sehmisch + + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Added new particle property "bounce" that makes + particles bounce off the ground and use it with the damage numbers. + 2007-02-21 Philipp Sehmisch * src/gui/char-server.cpp, src/gui/updatewindow.cpp, src/gui/main.cpp, @@ -286,6 +543,16 @@ * src/winver.h, README, configure.ac, data/help/header.txt, NEWS, CMakeLists.txt: Changed version to 0.0.22.2. +2007-02-15 Philipp Sehmisch + + * src/engine.cpp: The name conflict problem with Guichan seems to be + solved with version 0.6.1. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Added support for animated particles. + * data/graphics/particles/playerglow.particle.xml: Created a new + player follow particle that spawns a swarm of animated bats that + follow the player. + 2007-02-13 Philipp Sehmisch * src/gui/register.cpp, src/logindata.h, src/main.cpp: Fixed the _M/_F @@ -306,8 +573,36 @@ 2007-02-10 Philipp Sehmisch - * src/gui/viewport.cpp: Fixed the bug in the scrolling limitation that made - it possible to scroll outside of the map in the south and east. + * src/gui/viewport.cpp: Fixed the bug in the scrolling limitation that + made it possible to scroll outside of the map in the south and east. + +2007-02-09 Philipp Sehmisch + + * src/particle.cpp: Fixed a misspelled include and another + optimisation at the vector calculation. + +2007-02-08 Philipp Sehmisch + + * src/particle.cpp, src/utils/fastsqrt.h: Added a faster function to + calculate square roots and using it for hypotenuse calculations. + Thanks to Rogier aka Avaniel for finding the function. + +2007-02-07 Philipp Sehmisch + + * src/particle.cpp, src/particle.h, src/particleemitter.cpp: Renamed + Particle::MAX_PARTICLES to Particle::maxCount and read the value from + config ("particleMaxCount") + * src/particle.cpp: Added fast physics mode that replaces the + trigonometric calculations made for calculating the acceleration by + much less cpu intense but also less accurate formulas. To enable it + set the config option "particleFastPhysics" to "1". + * src/particle.cpp: Added the config option "particleEmitterSkip" that + allows to reduces the output of the emitters by making them spawn + particles only every n-th game tick. + * src/graphics.cpp, src/graphics.h: Added a new method + "drawImageTransparent" to the graphic engine that blits an image with + an alpha factor. + * src/particle.cpp: Using new drawImageTransparent method. 2007-02-04 Bjørn Lindeijer @@ -357,6 +652,35 @@ Defence: 12, Weight: 120. * data/graphics/sprites/chest-cotton-female.png: Huh? Shouldn't this be on svn for ages? + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Implemented die-distance (particles are deleted + when they reached a certain proximity to their target) + * src/particle.cpp: Fixed a bug in the acceleration vector calculation. + * src/particle.cpp, src/particle.h: Fixed a problem with particles with + unlimited lifetime and fade-in. + * data/graphics/particles/playerglow.particle.xml: And again a new + player follow particle. This time it demonstrates die-distance and the + fixed acceleration vector calculation. + * src/engine.cpp, data/graphics/particles/snow.particle.xml, + data/graphics/particles/snowflake.png: I can't stand the begging + anymore. Now it snows in the snow area... and the forest... and the + desert... and under the earth... and indoors... Are you happy now, + Rotonen and Elven? ;-) + * src/particle.cpp: Removed some debug log messages. + * src/being.cpp: Avoided crash when attempting to control an invalid + particle. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Cleaned the includes up. + +2007-01-31 Philipp Sehmisch + + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Changed some variable names. + * data/graphics/particles/waterfall.particle.xml, + data/graphics/particles/waterfall-a.png: New waterfall with Modanungs + waterfall particle. + * src/particle.cpp: forgot to remove a svn conflict marker and changed + the order of initialisations to fix some compiler warnings. 2007-01-30 Eugenio Favalli @@ -373,6 +697,54 @@ src/resources/mapreader.h, src/resources/music.h: Some trivial documentation work. Fixes all Doxygen warnings. +2007-01-30 Philipp Sehmisch + + * src/net/beinghandler.cpp, + data/graphics/particles/skillup.particle.xml: Added different particle + effect for job levelup. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Renamed "alphafade" to "fade-out", added new + property "fade-in". + * data/graphics/particles/playerglow.particle.xml: Added a new player + effect (a fire) demonstrating how to use fade-in and fade-out to fade + one color into another. + +2007-01-29 Philipp Sehmisch + + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Added a new particle property "alphafade" that + makes the particles fade into alpha before their lifetime ends. + * src/particle.cpp, src/particle.h: fixed an issue with particles that + have a lifetime of 0 and an issue with the momentum property. + * data/graphics/particles/waterfall.particle.xml, + data/graphics/particles/fog-medium-white-a.png, + data/graphics/particles/fog-medium-white-b.png, + data/graphics/particles/fog-medium-white-c.png: Added fog to the + waterfall effect demonstrating the new alphafade feature. + +2007-01-28 Philipp Sehmisch + + * src/utils/xml.cpp, src/utils/xml.h, src/particleemitter.cpp: Most + values are now read as floating point values from the emitter files. + * data/graphics/particles/fountain.particle.xml, + data/graphics/particles/hit.particle.xml, + data/graphics/particles/playerglow.particle.xml: Changed some values + as floating point values. Made the player follow effect magenta to + improve the visibility of the hit effects. + * src/engine.cpp, data/graphics/particles/waterfall.particle.xml: + Removed the fountain and added a waterfall instead. + * src/particle.h: Corrected the drawing order of the particles in + relation to the other sprites. + * src/gui/debugwindow.cpp, src/gui/debugwindow.h: Added particle count + to debug window. + * src/particle.cpp: Allowed momentum without acceleration and + implement the acceleration properly. + * src/utils/minmax.h, src/particleemitter.cpp, src/particleemitter.h: + Added a structure to hold a pair of numeric minimum and maximum values + and used it to store all numeric emitter properties. + * src/utils/randbetween.h: Removed (the functionality is now in struct + MinMax) + 2007-01-28 Bjørn Lindeijer * src/gui/char_select.h, src/net/messagein.h, @@ -383,6 +755,39 @@ * data/maps/new_8-1.tmx.gz, data/maps/new_11-1.tmx.gz: Map fixes by Pauan. +2007-01-27 Bjørn Lindeijer + + * src/gui/shoplistbox.cpp: Fixed compilation against Guichan 0.6.1. + * src/utils/randbetween.h: Fixed integer overflow causing the + randBetween function not to work properly on Linux. + +2007-01-27 Philipp Sehmisch + + * src/net/beinghandler.cpp: Fixed a compiler issue. + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h, src/engine.cpp: Emitter data is read from + external xml files. Reimplemented target-based particles with the + difference that they don't target beings or locations but other + particles (at the moment the host particle of the effect). + * src/being.cpp: Beings now move controlled particles to their center + instead of their upper left corner. + * data/graphics/particles/orb*: Added a bunch of new particles. + * data/graphics/particles/fountain.particle.xml: Reimplementation of + the fountain effect in XML. + * data/graphics/particles/playerglow.particle.xml: New effect that + spawns orbs that orbit around the origin. + * src/being.cpp, data/graphics/particles/hit.particle.xml: Added + particle effect on hit. + * src/net/beinghandler.cpp, + data/graphics/particles/levelup.particle.xml: Added particle effect on + levelup (own or other player). + +2007-01-24 Philipp Sehmisch + + * src/particle.cpp: Initialized all variables of the particles in the + constructor. + * src/particleemitter.cpp, src/particleemitter.h: minor cleanups. + 2007-01-23 Bjørn Lindeijer * src/gui/shoplistbox.cpp, docs/INSTALL/win32.txt, INSTALL, NEWS: @@ -393,6 +798,39 @@ * src/gui/updatewindow.cpp: Identify ourselves when requesting files from the update server. +2007-01-22 Philipp Sehmisch + + * src/being.cpp, src/being.h, src/particle.cpp, src/particle.h + src/particleemitter.cpp, src/particleemitter.h, src/engine.cpp: + Particle effects are now created in child particles of the root + particle. Particle emitters have no longer a being they check every + frame. Instead beings have the ability to take control of particles. + +2007-01-19 Philipp Sehmisch + + * src/particle.cpp, src/particle.h, src/particleemitter.cpp, + src/particleemitter.h: Implemented emitters that follow a being. + * src/engine.cpp: Added an emitter that follows the local player. + * src/particle.cpp: Fixed the crash on exit (reason was that the + mSpriteIterator wasn't initialized in every case) + +2007-01-18 Bjørn Lindeijer + + * src/properties.h, src/being.cpp, src/beingmanager.h, src/sound.h, + src/gui/window.h, src/sound.cpp, src/main.h, src/being.h, + src/resources/soundeffect.h, src/resources/image.h, + src/resources/mapreader.h, src/resources/music.h: Some trivial + documentation work. Fixes all Doxygen warnings. + * src/particle.h, src/particle.cpp, src/CMakeLists.txt, + src/Makefile.am: Fixed compilation issues on Linux. + * src/gui/char_select.h, src/net/messagein.h, + src/net/messagehandler.h, src/net/network.h, src/net/connection.h, + src/net/messageout.h, src/utils/xml.h, src/main.h, + src/resources/monsterdb.h, src/resources/itemdb.h, + src/resources/equipmentdb.h: Some work on documentation. + * data/maps/new_8-1.tmx.gz, data/maps/new_11-1.tmx.gz: Map fixes by + Pauan. + 2007-01-17 Eugenio Favalli * docs/win32-release.txt, src/gui/register.cpp, src/main.cpp: Changed @@ -408,6 +846,12 @@ * data/help/header.txt, NEWS, README: Updated release date. +2007-01-15 Philipp Sehmisch + + * src/game.cpp, src/particle.cpp, src/particle.h, + src/particleemitter.h: Made the particle count global and more + performant. + 2007-01-14 Eugenio Favalli * src/gui/updatewindow.cpp, src/main.cpp, tmw.cbp: Fixed windows @@ -448,6 +892,17 @@ * src/winver.h, configure.ac, data/help/header.txt, NEWS, README, CMakeLists.txt: Updated version to 0.0.22.1. +2007-01-14 Philipp Sehmisch + + * src/particle.cpp, src/particle.h; src/particleemitter.cpp, + src/particleemitter.h, src/utils/randbetween.h: + Implemented particle engine. + * src/engine.cpp, src/game.cpp: added calls to the particle engine + * data/graphics/particles/*: added a bunch of particle graphics for + testing purpose. + * particleengine-todo.txt: Added particle engine todo list (please + omit when merging) + 2007-01-13 Bjørn Lindeijer * data/graphics/sprites/Makefile.am, @@ -1298,7 +1753,7 @@ 2006-10-12 Yohann Ferreira * debian/rules, debian/tmw-data.install, debian/tmw-data.dirs, - debian/tmw-music.install, debian/changelog: Updating debian files for + debian/tmw-music.install, debian/changelog: Updating Debian files for bug fixing. 2006-10-12 Frode Lindeijer @@ -1473,7 +1928,7 @@ * src/animation.h, src/animatedsprite.h, data/graphics/sprites/weapon.xml: Some modifications at the animation system. No more "undefined action foo" warnings in the tmw.log. Not - visible actions must now be declared explicitely. + visible actions must now be declared explicitly. * data/graphics/images/ambient/sandstorm.png, data/graphics/images/ambient/clouds.png: Improved quality of the overlay graphics. @@ -1892,7 +2347,7 @@ with more distinctive names. (no, i won't list all 114) * src/itemmanager.cpp, data/items.xml: Replaced indices on the item spriteset with filenames. added names and descriptions for all missing - items. Changed names and dascriptions of some items. + items. Changed names and descriptions of some items. * src/engine.cpp: Removed global item spriteset. * src/floor_item.cpp, src/floor_item.h, src/iteminfo.cpp, src/iteminfo.h, src/equipmentwindow.cpp, src/equipmentwindow.h, diff --git a/NEWS b/NEWS index 5281cf78..9529ae1b 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,19 @@ +0.0.23 (3 June 2007) +- Added a particle engine along with some particle effects +- Added a cursor to indicate targeted enemy +- Added new program icon +- Added a man page for UNIX like systems +- Added the --version command line parameter +- Improved MacOS X release +- Screenshots are now saved in the .tmw directory on UNIX like systems +- Magic pink is no longer used for transparency (fixes issues with that on Mac) +- Fixed difficulties with resizing windows +- Fixed misleading error message when connecting fails +- Fixed wrong error message when account name already exists +- Fixed crash when deleting a character +- Fixed error message when creating a new character fails +- Fixed updating problem when using scrollwheel to change shop selection + 0.0.22.2 (17 February 2007) - Updated to work with Guichan 0.6.1 - Changed to new default server (server.themanaworld.org) diff --git a/README b/README index 2d6f07b1..39677e1e 100644 --- a/README +++ b/README @@ -1,8 +1,7 @@ THE MANA WORLD ============== - Version: 0.0.22.2 Date: 17/02/2007 - + Version: 0.1.0 Date: XX/XX/2007 Development team: - See AUTHORS file for a list diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt index 1549b2b4..5a02d7f1 100644 --- a/data/graphics/gui/CMakeLists.txt +++ b/data/graphics/gui/CMakeLists.txt @@ -30,8 +30,12 @@ SET (FILES sansserif8.png selection.png slider.png - target-cursor-blue.png - target-cursor-red.png + target-cursor-blue-l.png + target-cursor-blue-m.png + target-cursor-blue-s.png + target-cursor-red-l.png + target-cursor-red-m.png + target-cursor-red-s.png thickborder.png vscroll_blue.png vscroll_down_default.png diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am index c0e0655b..a37e1196 100644 --- a/data/graphics/gui/Makefile.am +++ b/data/graphics/gui/Makefile.am @@ -33,6 +33,12 @@ gui_DATA = \ sansserif8.png \ selection.png \ slider.png \ + target-cursor-blue-l.png \ + target-cursor-blue-m.png \ + target-cursor-blue-s.png \ + target-cursor-red-l.png \ + target-cursor-red-m.png \ + target-cursor-red-s.png \ thickborder.png \ vscroll_blue.png \ vscroll_down_default.png \ diff --git a/data/graphics/gui/target-cursor-blue-l.png b/data/graphics/gui/target-cursor-blue-l.png new file mode 100644 index 00000000..77cdf4b6 Binary files /dev/null and b/data/graphics/gui/target-cursor-blue-l.png differ diff --git a/data/graphics/gui/target-cursor-blue-m.png b/data/graphics/gui/target-cursor-blue-m.png new file mode 100644 index 00000000..c0107357 Binary files /dev/null and b/data/graphics/gui/target-cursor-blue-m.png differ diff --git a/data/graphics/gui/target-cursor-blue-s.png b/data/graphics/gui/target-cursor-blue-s.png new file mode 100644 index 00000000..3e81c75d Binary files /dev/null and b/data/graphics/gui/target-cursor-blue-s.png differ diff --git a/data/graphics/gui/target-cursor-blue.png b/data/graphics/gui/target-cursor-blue.png deleted file mode 100644 index 3e81c75d..00000000 Binary files a/data/graphics/gui/target-cursor-blue.png and /dev/null differ diff --git a/data/graphics/gui/target-cursor-red-l.png b/data/graphics/gui/target-cursor-red-l.png new file mode 100644 index 00000000..76d2101b Binary files /dev/null and b/data/graphics/gui/target-cursor-red-l.png differ diff --git a/data/graphics/gui/target-cursor-red-m.png b/data/graphics/gui/target-cursor-red-m.png new file mode 100644 index 00000000..e2ab79c2 Binary files /dev/null and b/data/graphics/gui/target-cursor-red-m.png differ diff --git a/data/graphics/gui/target-cursor-red-s.png b/data/graphics/gui/target-cursor-red-s.png new file mode 100644 index 00000000..09195f44 Binary files /dev/null and b/data/graphics/gui/target-cursor-red-s.png differ diff --git a/data/graphics/gui/target-cursor-red.png b/data/graphics/gui/target-cursor-red.png deleted file mode 100644 index 09195f44..00000000 Binary files a/data/graphics/gui/target-cursor-red.png and /dev/null differ diff --git a/data/help/changes.txt b/data/help/changes.txt index f8a3eb67..dd062e49 100644 --- a/data/help/changes.txt +++ b/data/help/changes.txt @@ -3,99 +3,56 @@ ##3 === RECENT CHANGES === - 0.0.21 (17 September 2006) - - Added item pickup messages to the chat dialog - - Added XP bar to ministatus in the top left - - Added configurable smooth and lazy scrolling - - Added option to turn off the joystick - - Added --playername option for automatic character picking - - Added --configfile option for specifying which configuration file to use - - Added shortcut and middle mouse button for targetting nearest monster - - Added support for map effect overlays - - Fixed FPS limiter - - Fixed updating system on Windows - - Fixed player animations going out of sync on changing equipment or hairstyle - - Fixed SDL_image configure check on some systems by first checking for libpng - - Fixed big memory leak when using OpenGL - - Updated to work with Guichan 0.5.0 (older versions no longer supported) - - 0.0.20 (24 July 2006) - - Added new hairstyle, and some fixes to the old ones - - Added slider to set FPS limit - - Added visible equipments - - Added new maps and monsters - - Added female characters - - Implemented a new animation system - - Updated the updating system - - Reduced size of textures to stay within the limits of some OpenGL drivers - - Fixed connection not being shut down completely in case of an error - - Fixed min size of a window when resizing - - Fixed some maps issues - - Some fixes to monsters and player graphics - - Minor bug fixes and lots of code cleanups - - 0.0.19 (6 March 2006) - - - Added --username, --password and --defaults command line options - - Improved login sequence - - Enabled 3 slots to create players - - Improved setup window and added a joystick calibration tool - - Some maps fixes - - Reorganized and improved network code - - Fixed some bugs - - Made the player walk to items prior to picking them up - - Added new playerset - - Lots of cleanups and code re-roganization - - 0.0.18.1 (30 December 2005) - - - Fixed a drawing glitch with high tiles at the bottom of the screen - - Fixed glitches caused by fading out the damage display - - 0.0.18 (20 December 2005) - - - Added new items, npcs, tilesets, maps and monsters - - Non blocking connection at startup - - Enabled monster emotions - - Client version is now displayed during login - - Fixed setup window behaviour - - Fixed a Windows crash issue - - Fixed ScrollArea and BrowserBox behaviour - - Code cleanups - - 0.0.17 (10 October 2005) - - - Added remembering of window position and sizes - - Added taking screenshot with Alt+P - - Added notice about the player being overweight - - Added time to chat messages - - Added messagebox on error for MacOS X - - Added new network layer based on SDL_net - - Added proper error message for when the map server goes offline - - Added more international characters to fixed and rpg fonts - - Improved damage text font, shadow is now translucent - - Improved GUI layout, new profile window - - Improved support for building on FreeBSD and MacOS X - - Improved tile engine to fix graphics glitches and make mapping easier - - Rearranged keyboard shortcuts - - Fixed items on map to be removed on map switch - - Fixed OpenGL checkbox in the setup window to be usable - - Cleaned up a lot of code - - 0.0.16 (04 September 2005) - - - Added inn and casino - - Improved status window - - Improved OpenGL support - - Removed lot of bugs - - Code cleanups - - 0.0.15 (31 July 2005) - - - Added dynamic updating of client data - - Added much better font for chat and names - - Added option not to use the custom mouse cursor - - Added joystick support - - Improved mouse attack by not walking while pressing shift - - Fixed items being shown as equipped in inventory although they are not + 0.0.23 (3 June 2007) + - Added a particle engine along with some particle effects + - Added a cursor to indicate targeted enemy + - Added new program icon + - Added a man page for UNIX like systems + - Added the --version command line parameter + - Improved MacOS X release + - Screenshots are now saved in the .tmw directory on UNIX like systems + - Magic pink is no longer used for transparency (fixes issues with that on Mac) + - Fixed difficulties with resizing windows + - Fixed misleading error message when connecting fails + - Fixed wrong error message when account name already exists + - Fixed crash when deleting a character + - Fixed error message when creating a new character fails + - Fixed updating problem when using scrollwheel to change shop selection + + 0.0.22.2 (17 February 2007) + - Updated to work with Guichan 0.6.1 + - Changed to new default server (server.themanaworld.org) + - Changed custom mouse cursor + - Fixed the issue where _M or _F is appended to the username + - Fixed problem with Cancel button in update dialog + + 0.0.22.1 (15 January 2007) + - Updated to work with Guichan 0.6.0 (older versions no longer supported) + - Fixed mouse coordinates in debug window + - Fixed clicking on GUI to cause the player to start walking sometimes + + 0.0.22 (24 December 2006) + - Added support for female-specific equipment graphics + - Added support for monster sounds + - Added item icons to buy/sell dialogs + - Enhanced character select dialog to show equipment + - Changed to new update host (http://updates.themanaworld.org) + - Worked around a Guichan exception thrown for mice with many buttons + - Changed mouse walk to keep following mouse while button is held down + - Extended font support for Ã¥ and Ã… + - Disabled RLE compression on all surfaces in software mode + - Fixed joystick setting not to show disabled when it's actually enabled + - Fixed money field to no longer hide below the bottom of the window + - Fixed pathfinding to allow walking through beings when they block your path + - Fixed an issue with NPC dialogs staying open after player respawn + + 0.0.21.1 (30 October 2006) + - Reload wallpaper after loading updates + - Added support for gzip compressed map layer data + - Added support for building with CMake + - Added slider to setup dialog for configuring overlay effect + - Fixed excessive unnecessary reloading of sprites + - Fixed problem with OpenGL related redefinition + - Fixed problems with hiding windows using h + - Fixed trade window positioning diff --git a/data/help/header.txt b/data/help/header.txt index 7311c111..b10ed991 100644 --- a/data/help/header.txt +++ b/data/help/header.txt @@ -2,7 +2,7 @@ ##1 T H E M A N A W O R L D ##1 ========================================== - ##2Version:##6 0.0.22.2 ##2Date:##317 February 2007 + ##2Version:##6 0.0.23 ##2Date:##33 June 2007 ##2 Website: http://themanaworld.org diff --git a/docs/Makefile.am b/docs/Makefile.am index 8b57d5bb..1ee9a9a6 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -1,6 +1,7 @@ man6_MANS = tmw.6 -EXTRA_DIST = packages.txt \ +EXTRA_DIST = $(man6_MANS) \ + packages.txt \ FAQ.txt \ HACKING.txt \ SOURCE/tmwdox.sh \ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e28e235e..7a4da70d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -47,6 +47,8 @@ MARK_AS_ADVANCED(SDL_INCLUDE_DIR) MARK_AS_ADVANCED(SDL_LIBRARY) SET(SRCS + gui/widgets/resizegrip.cpp + gui/widgets/resizegrip.h gui/box.cpp gui/box.h gui/browserbox.cpp @@ -275,11 +277,15 @@ SET(SRCS utils/base64.cpp utils/base64.h utils/dtor.h + utils/fastsqrt.h + utils/minmax.h utils/tostring.h utils/xml.cpp utils/xml.h animatedsprite.cpp animatedsprite.h + animationparticle.cpp + animationparticle.h being.cpp being.h beingmanager.cpp @@ -304,6 +310,8 @@ SET(SRCS graphics.cpp graphics.h guichanfwd.h + imageparticle.cpp + imageparticle.h inventory.cpp inventory.h item.cpp @@ -326,6 +334,10 @@ SET(SRCS npc.h openglgraphics.cpp openglgraphics.h + particle.cpp + particle.h + particleemitter.cpp + particleemitter.h player.cpp player.h properties.h @@ -335,6 +347,8 @@ SET(SRCS sound.cpp sound.h sprite.h + textparticle.cpp + textparticle.h tileset.h ) diff --git a/src/Makefile.am b/src/Makefile.am index f1f51b79..92c1b1b2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,6 +3,8 @@ AUTOMAKE_OPTIONS = subdir-objects bin_PROGRAMS = tmw tmw_SOURCES = gui/widgets/dropdown.cpp \ gui/widgets/dropdown.h \ + gui/widgets/resizegrip.cpp \ + gui/widgets/resizegrip.h \ gui/browserbox.cpp \ gui/browserbox.h \ gui/buddywindow.cpp \ @@ -229,11 +231,15 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ utils/base64.cpp \ utils/base64.h \ utils/dtor.h \ + utils/fastsqrt.h \ + utils/minmax.h \ utils/tostring.h \ utils/xml.cpp \ utils/xml.h \ animatedsprite.cpp \ animatedsprite.h \ + animationparticle.cpp \ + animationparticle.h \ being.cpp \ being.h \ beingmanager.cpp \ @@ -258,6 +264,8 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ graphics.cpp \ graphics.h \ guichanfwd.h \ + imageparticle.cpp \ + imageparticle.h \ inventory.cpp \ inventory.h \ item.cpp \ @@ -280,15 +288,21 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ npc.h \ openglgraphics.cpp\ openglgraphics.h \ + particle.cpp \ + particle.h \ + particleemitter.cpp \ + particleemitter.h \ player.cpp \ player.h \ properties.h \ serverinfo.h \ simpleanimation.cpp \ - simpleanimation.h \ + simpleanimation.h \ sound.cpp \ sound.h \ sprite.h \ + textparticle.cpp \ + textparticle.h \ tileset.h # set the include path found by configure diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 7260a512..c1e89ff0 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -197,3 +197,27 @@ AnimatedSprite::setDirection(SpriteDirection direction) } } } + +int +AnimatedSprite::getWidth() const +{ + if (mFrame) + { + return mFrame->image->getWidth(); + } + else { + return 0; + } +} + +int +AnimatedSprite::getHeight() const +{ + if (mFrame) + { + return mFrame->image->getHeight(); + } + else { + return 0; + } +} diff --git a/src/animatedsprite.h b/src/animatedsprite.h index 2257c0f0..42c0a743 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.h @@ -85,6 +85,18 @@ class AnimatedSprite bool draw(Graphics* graphics, int posX, int posY) const; + /** + * gets the width in pixels of the image of the current frame + */ + int + getWidth() const; + + /** + * gets the height in pixels of the image of the current frame + */ + int + getHeight() const; + /** * Sets the direction. */ diff --git a/src/animationparticle.cpp b/src/animationparticle.cpp new file mode 100644 index 00000000..30c33da7 --- /dev/null +++ b/src/animationparticle.cpp @@ -0,0 +1,51 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "animationparticle.h" + +#include "graphics.h" +#include "simpleanimation.h" + +AnimationParticle::AnimationParticle(Map *map, Animation *animation): + ImageParticle(map, 0), + mAnimation(new SimpleAnimation(animation)) +{ +} + +AnimationParticle::AnimationParticle(Map *map, xmlNodePtr animationNode): + ImageParticle(map, 0), + mAnimation(new SimpleAnimation(animationNode)) +{ +} + +AnimationParticle::~AnimationParticle() +{ + delete mAnimation; +} + +bool AnimationParticle::update() +{ + mAnimation->update(10); // particle engine is updated every 10ms + mImage = mAnimation->getCurrentImage(); + + return Particle::update(); +} diff --git a/src/animationparticle.h b/src/animationparticle.h new file mode 100644 index 00000000..054b1b73 --- /dev/null +++ b/src/animationparticle.h @@ -0,0 +1,49 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef _ANIMATION_PARTICLE +#define _ANIMATION_PARTICLE + +#include + +#include "imageparticle.h" + +class Animation; +class Map; +class SimpleAnimation; + +class AnimationParticle : public ImageParticle +{ + public: + AnimationParticle(Map *map, Animation *animation); + + AnimationParticle(Map *map, xmlNodePtr animationNode); + + ~AnimationParticle(); + + virtual bool update(); + + private: + SimpleAnimation *mAnimation; /**< Used animation for this particle */ +}; + +#endif diff --git a/src/being.cpp b/src/being.cpp index 682daddb..7ba9ddb9 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -32,12 +32,16 @@ #include "graphics.h" #include "log.h" #include "map.h" +#include "particle.h" #include "resources/resourcemanager.h" #include "resources/imageset.h" #include "gui/gui.h" +#include "resources/resourcemanager.h" +#include "resources/imageset.h" + #include "utils/dtor.h" #include "utils/tostring.h" @@ -61,7 +65,6 @@ Being::Being(Uint16 id, Uint16 job, Map *map): mMap(NULL), mHairStyle(0), mHairColor(0), mSpeechTime(0), - mDamageTime(0), mPx(0), mPy(0), mSprites(VECTOREND_SPRITE, NULL), mEquipmentSpriteIDs(VECTOREND_SPRITE, 0) @@ -85,6 +88,13 @@ Being::~Being() clearPath(); setMap(NULL); + for ( std::list::iterator i = mChildParticleEffects.begin(); + i != mChildParticleEffects.end(); + i++) + { + (*i)->kill(); + } + instances--; if (instances == 0) @@ -292,8 +302,32 @@ Being::setSpeech(const std::string &text, Uint32 time) void Being::takeDamage(int amount) { - mDamage = amount ? toString(amount) : "miss"; - mDamageTime = 300; + gcn::Font* font; + std::string damage = amount ? toString(amount) : "miss"; + + // Selecting the right color + if (damage == "miss") + { + font = hitYellowFont; + } + else + { + // hit particle effect + controlParticle(particleEngine->addEffect("graphics/particles/hit.particle.xml", 0, 0)); + + if (getType() == MONSTER) + { + font = hitBlueFont; + } + else + { + font = hitRedFont; + } + } + + // show damage number + particleEngine->addTextSplashEffect(damage, 255, 255, 255, font, + mPx + 16, mPy + 16); } void @@ -318,6 +352,19 @@ Being::setMap(Map *map) { mSpriteIterator = mMap->addSprite(this); } + + //clear particle effect list because child particles became invalid + mChildParticleEffects.clear(); +} + +void +Being::controlParticle(Particle *particle) +{ + if (particle) + { + particle->disableAutoDelete(); //the effect may not die without the beings permission or we segvault + mChildParticleEffects.push_back(particle); + } } void @@ -465,10 +512,6 @@ Being::logic() if (mSpeechTime > 0) mSpeechTime--; - // Reduce the time that damage is still displayed - if (mDamageTime > 0) - mDamageTime--; - // Update pixel coordinates mPx = mX - 16 + getXOffset(); mPy = mY - 16 + getYOffset(); @@ -489,6 +532,14 @@ Being::logic() mSprites[i]->update(tick_time * 10); } } + + //Update particle effects + for ( std::list::iterator i = mChildParticleEffects.begin(); + i != mChildParticleEffects.end(); + i++) + { + (*i)->setPosition((float)mPx + 16.0f, (float)mPy + 32.0f); + } } void @@ -531,37 +582,6 @@ Being::drawSpeech(Graphics *graphics, int offsetX, int offsetY) graphics->setColor(gcn::Color(255, 255, 255)); graphics->drawText(mSpeech, px + 18, py - 60, gcn::Graphics::CENTER); } - - // Draw damage above this being - if (mDamageTime > 0 && mDamageTime < 275) - { - // Selecting the right color - if (mDamage == "miss") - { - graphics->setFont(hitYellowFont); - } - else if (getType() == MONSTER) - { - graphics->setFont(hitBlueFont); - } - else - { - graphics->setFont(hitRedFont); - } - - int textY = (getType() == MONSTER) ? 32 : 70; - int ft = 150 - mDamageTime; - float a = (ft > 0) ? 1.0 - ft / 150.0 : 1.0; - - graphics->setColor(gcn::Color(255, 255, 255, (int)(255 * a))); - graphics->drawText(mDamage, - px + 16, - py - textY - (300 - mDamageTime) / 10, - gcn::Graphics::CENTER); - - // Reset alpha value - graphics->setColor(gcn::Color(255, 255, 255)); - } } Being::Type @@ -632,3 +652,29 @@ int Being::getOffset(int step) const return offset; } + + +int +Being::getWidth() const +{ + if (mSprites[BASE_SPRITE]) + { + return mSprites[BASE_SPRITE]->getWidth(); + } + else { + return 0; + } +} + + +int +Being::getHeight() const +{ + if (mSprites[BASE_SPRITE]) + { + return mSprites[BASE_SPRITE]->getHeight(); + } + else { + return 0; + } +} diff --git a/src/being.h b/src/being.h index 332f1b4a..8820c30a 100644 --- a/src/being.h +++ b/src/being.h @@ -42,6 +42,7 @@ class Item; class Map; class Graphics; class ImageSet; +class Particle; /** * A position along a being's path. @@ -97,6 +98,13 @@ class Being : public Sprite VECTOREND_SPRITE }; + enum TargetCursorSize { + TC_SMALL = 0, + TC_MEDIUM, + TC_LARGE, + NUM_TC + }; + /** * Directions, to be used as bitmask values @@ -359,8 +367,33 @@ class Being : public Sprite int getYOffset() const { return getOffset(mStepY); } + /** + * Returns the horizontal size of the current base sprite of the being + */ + virtual int + getWidth() const; + + /** + * Returns the vertical size of the current base sprite of the being + */ + virtual int + getHeight() const; + + /** + * Returns the required size of a target cursor for this being + */ + virtual Being::TargetCursorSize + getTargetCursorSize() const + { return TC_MEDIUM; } + std::auto_ptr mEquipment; + /** + * Take control of a particle + */ + void + controlParticle(Particle *particle); + protected: /** * Sets the new path for this being. @@ -380,14 +413,13 @@ class Being : public Sprite Path mPath; std::string mSpeech; - std::string mDamage; Uint16 mHairStyle, mHairColor; Uint32 mSpeechTime; - Uint32 mDamageTime; Sint32 mPx, mPy; /**< Pixel coordinates */ std::vector mSprites; std::vector mEquipmentSpriteIDs; + std::list mChildParticleEffects; private: int diff --git a/src/engine.cpp b/src/engine.cpp index 31bec9ff..3b5fb403 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -35,6 +35,7 @@ #include "localplayer.h" #include "log.h" #include "map.h" +#include "particle.h" #include "sound.h" #include "gui/gui.h" @@ -63,6 +64,7 @@ void Engine::changeMap(const std::string &mapPath) floorItemManager->clear(); beingManager->clear(); + particleEngine->clear(); // Store full map path in global var map_path = "maps/" + mapPath; @@ -83,8 +85,12 @@ void Engine::changeMap(const std::string &mapPath) } minimap->setMapImage(mapImage); beingManager->setMap(newMap); + particleEngine->setMap(newMap); viewport->setMap(newMap); + // Initialize map-based particle effects + newMap->initializeParticleEffects(particleEngine); + // Start playing new music file when necessary std::string oldMusic = ""; @@ -106,5 +112,6 @@ void Engine::changeMap(const std::string &mapPath) void Engine::logic() { beingManager->logic(); + particleEngine->update(); gui->logic(); } diff --git a/src/game.cpp b/src/game.cpp index ba4e2b9d..1afc530b 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -41,6 +41,7 @@ #include "localplayer.h" #include "log.h" #include "npc.h" +#include "particle.h" #include "gui/buy.h" #include "gui/buysell.h" @@ -121,6 +122,8 @@ BeingManager *beingManager = NULL; FloorItemManager *floorItemManager = NULL; ChannelManager *channelManager = NULL; +Particle *particleEngine = NULL; + const int MAX_TIME = 10000; /** @@ -242,6 +245,9 @@ Game::Game(): floorItemManager = new FloorItemManager(); channelManager = new ChannelManager(); + particleEngine = new Particle(NULL); + particleEngine->setupEngine(); + // Initialize timers tick_time = 0; mLogicCounterId = SDL_AddTimer(10, nextTick, NULL); //Logic counter @@ -286,6 +292,7 @@ Game::~Game() delete floorItemManager; delete channelManager; delete joystick; + delete particleEngine; beingManager = NULL; floorItemManager = NULL; @@ -308,7 +315,9 @@ bool saveScreenshot(SDL_Surface *screenshot) screenshotCount++; filename.str(""); #if (defined __USE_UNIX98 || defined __FreeBSD__ || defined __APPLE__) - filename << PHYSFS_getUserDir() << "/"; + filename << PHYSFS_getUserDir() << ".tmw/"; +#elif defined __APPLE__ + filename << PHYSFS_getUserDir() << "Desktop/"; #endif filename << "TMW_Screenshot_" << screenshotCount << ".png"; testExists.open(filename.str().c_str(), std::ios::in); @@ -316,7 +325,18 @@ bool saveScreenshot(SDL_Surface *screenshot) testExists.close(); } while (!found); - return ImageWriter::writePNG(screenshot, filename.str()); + if (ImageWriter::writePNG(screenshot, filename.str())) + { + std::stringstream chatlogentry; + chatlogentry << "Screenshot saved to " << filename.str().c_str(); + chatWindow->chatLog(chatlogentry.str(), BY_SERVER); + return true; + } + else + { + chatWindow->chatLog("Saving screenshot failed!", BY_SERVER); + return false; + } } void Game::optionChanged(const std::string &name) diff --git a/src/graphics.cpp b/src/graphics.cpp index f007470a..1e31f903 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -136,8 +136,6 @@ bool Graphics::drawImage(Image *image, int srcX, int srcY, int dstX, int dstY, srcX += image->mBounds.x; srcY += image->mBounds.y; - - SDL_Rect dstRect; SDL_Rect srcRect; dstRect.x = dstX; dstRect.y = dstY; diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index cb07da22..2a8616f8 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -111,27 +111,21 @@ void BuyDialog::setMoney(int amount) { mMoney = amount; mShopItemList->setPlayersMoney(amount); - mMoneyLabel->setCaption("Price: 0 GP / " + toString(mMoney) + " GP"); - mMoneyLabel->adjustSize(); + + updateButtonsAndLabels(); } void BuyDialog::reset() { mShopItems->clear(); + mShopItemList->adjustSize(); mMoney = 0; mSlider->setValue(0.0); - mAmountItems = 0; // Reset Previous Selected Items to prevent failing asserts mShopItemList->setSelected(-1); - mIncreaseButton->setEnabled(false); - mDecreaseButton->setEnabled(false); - mQuantityLabel->setCaption("0"); - mQuantityLabel->adjustSize(); - mMoneyLabel->setCaption("Price: 0 GP / " + toString(mMoney) + " GP"); - mMoneyLabel->adjustSize(); - mItemDescLabel->setCaption(""); - mItemEffectLabel->setCaption(""); + + updateButtonsAndLabels(); } void BuyDialog::addItem(short id, int price) @@ -151,45 +145,36 @@ void BuyDialog::action(const gcn::ActionEvent &event) } // The following actions require a valid selection - if (selectedItem < 0 || selectedItem >= int(mShopItems->getNumberOfElements())) + if (selectedItem < 0 || + selectedItem >= (int) mShopItems->getNumberOfElements()) { return; } - bool updateButtonsAndLabels = false; - if (event.getId() == "slider") { mAmountItems = (int)(mSlider->getValue() * mMaxItems); - updateButtonsAndLabels = true; + updateButtonsAndLabels(); } - else if (event.getId() == "+") + else if (event.getId() == "+" && mAmountItems < mMaxItems) { - if (mAmountItems < mMaxItems) { - mAmountItems++; - } else { - mAmountItems = mMaxItems; - } + mAmountItems++; - mSlider->setValue(double(mAmountItems)/double(mMaxItems)); - updateButtonsAndLabels = true; + mSlider->setValue((double) mAmountItems / (double) mMaxItems); + updateButtonsAndLabels(); } - else if (event.getId() == "-") + else if (event.getId() == "-" && mAmountItems > 0) { - if (mAmountItems > 0) { - mAmountItems--; - } else { - mAmountItems = 0; - } + mAmountItems--; - mSlider->setValue(double(mAmountItems)/double(mMaxItems)); - updateButtonsAndLabels = true; + mSlider->setValue((double) mAmountItems / (double) mMaxItems); + updateButtonsAndLabels(); } // TODO: Actually we'd have a bug elsewhere if this check for the number // of items to be bought ever fails, Bertram removed the assertions, is // there a better way to ensure this fails in an _obivous_ way in C++? - else if (event.getId() == "buy" && (mAmountItems > 0 && - mAmountItems <= mMaxItems)) + else if (event.getId() == "buy" && mAmountItems > 0 && + mAmountItems <= mMaxItems) { // XXX Convert for new server /* @@ -199,38 +184,15 @@ void BuyDialog::action(const gcn::ActionEvent &event) outMsg.writeShort(mShopItems->at(selectedItem).id); */ - // update money ! + // Update money and adjust the max number of items that can be bought mMoney -= mAmountItems * mShopItems->at(selectedItem).price; - // Update number of items that can be bought at max mMaxItems -= mAmountItems; - if (!mMaxItems) { - mSlider->setEnabled(false); - } - // Reset selection mAmountItems = 0; - mSlider->setValue(0); - - updateButtonsAndLabels = true; - } + mSlider->setValue(0.0); - // If anything has changed, we have to update the buttons and labels - if (updateButtonsAndLabels) - { - // Update buttons - mIncreaseButton->setEnabled(mAmountItems < mMaxItems); - mDecreaseButton->setEnabled(mAmountItems > 0); - mBuyButton->setEnabled(mAmountItems > 0); - - // Update labels - mQuantityLabel->setCaption(toString(mAmountItems)); - mQuantityLabel->adjustSize(); - - int price = mAmountItems * mShopItems->at(selectedItem).price; - mMoneyLabel->setCaption("Price: " + toString(price) + " GP / " - + toString(mMoney) + " GP" ); - mMoneyLabel->adjustSize(); + updateButtonsAndLabels(); } } @@ -238,17 +200,16 @@ void BuyDialog::selectionChanged(const SelectionEvent &event) { // Reset amount of items and update labels mAmountItems = 0; - mSlider->setValue(0); - mQuantityLabel->setCaption("0"); - mQuantityLabel->adjustSize(); - mMoneyLabel->setCaption("Price: 0 GP / " + toString(mMoney) + " GP"); - mMoneyLabel->adjustSize(); + mSlider->setValue(0.0); - // Disable buttons for buying and decreasing - mBuyButton->setEnabled(false); - mDecreaseButton->setEnabled(false); + updateButtonsAndLabels(); +} +void +BuyDialog::updateButtonsAndLabels() +{ int selectedItem = mShopItemList->getSelected(); + int price = 0; if (selectedItem > -1) { @@ -259,16 +220,32 @@ void BuyDialog::selectionChanged(const SelectionEvent &event) // Calculate how many the player can afford mMaxItems = mMoney / mShopItems->at(selectedItem).price; + if (mAmountItems > mMaxItems) + { + mAmountItems = mMaxItems; + } + + // Calculate price of pending purchase + price = mAmountItems * mShopItems->at(selectedItem).price; } else { mItemDescLabel->setCaption("Description:"); mItemEffectLabel->setCaption("Effect:"); mMaxItems = 0; + mAmountItems = 0; } - // When at least one item can be bought, enable the slider and the - // increase button - mIncreaseButton->setEnabled(mMaxItems > 0); + // Enable or disable buttons and slider + mIncreaseButton->setEnabled(mAmountItems < mMaxItems); + mDecreaseButton->setEnabled(mAmountItems > 0); + mBuyButton->setEnabled(mAmountItems > 0); mSlider->setEnabled(mMaxItems > 0); + + // Update quantity and money labels + mQuantityLabel->setCaption(toString(mAmountItems)); + mQuantityLabel->adjustSize(); + mMoneyLabel->setCaption("Price: " + toString(price) + " GP / " + + toString(mMoney - price) + " GP" ); + mMoneyLabel->adjustSize(); } diff --git a/src/gui/buy.h b/src/gui/buy.h index 13116b6e..7834a434 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -92,6 +92,12 @@ class BuyDialog : public Window, public gcn::ActionListener, SelectionListener */ std::string getElementAt(int i); + /** + * Updates the state of buttons and labels. + */ + void + updateButtonsAndLabels(); + private: gcn::Button *mBuyButton; gcn::Button *mQuitButton; diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index eb6b7612..48df9efe 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -160,7 +160,7 @@ ChatWindow::chatLog(std::string line, int own, std::string channelName) break; case BY_OTHER: tmp.nick += CAT_NORMAL; - lineColor = "##4"; // Equiv. to BrowserBox::ORANGE + lineColor = "##0"; // Equiv. to BrowserBox::BLACK break; case BY_SERVER: tmp.nick += std::string("Server: "); @@ -195,7 +195,7 @@ ChatWindow::chatLog(std::string line, int own, std::string channelName) // We look if the Vertical Scroll Bar is set at the max before // adding a row, otherwise the max will always be a row higher // at comparison. - if (mScrollArea->getVerticalScrollAmount() == mScrollArea->getVerticalMaxScroll() ) + if (mScrollArea->getVerticalScrollAmount() == mScrollArea->getVerticalMaxScroll()) { mTextOutput->addRow(line); mScrollArea->setVerticalScrollAmount(mScrollArea->getVerticalMaxScroll()); diff --git a/src/gui/chat.h b/src/gui/chat.h index c7e51ebf..6f9b91fe 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.h @@ -168,13 +168,13 @@ class ChatWindow : public Window, public gcn::ActionListener, /* * Determines whether to send a command or an ordinary message, then - * contructs packets & sends them + * 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 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 diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 563f380f..ebf7d974 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -33,6 +33,7 @@ #include "../game.h" #include "../engine.h" +#include "../particle.h" #include "../map.h" #include "../utils/tostring.h" @@ -58,6 +59,9 @@ DebugWindow::DebugWindow(): mTileMouseLabel = new gcn::Label("[Mouse: 0, 0]"); mTileMouseLabel->setPosition(100, 0); + mParticleCountLabel = new gcn::Label("[Particle count: 0]"); + mParticleCountLabel->setPosition(100, 60); + Button *closeButton = new Button("Close", "close", this); closeButton->setPosition(5, 60); @@ -65,6 +69,7 @@ DebugWindow::DebugWindow(): add(mMusicFileLabel); add(mMapFileLabel); add(mTileMouseLabel); + add(mParticleCountLabel); add(closeButton); } @@ -97,6 +102,11 @@ DebugWindow::logic() mMapFileLabel->setCaption(minimap); mMapFileLabel->adjustSize(); } + + mParticleCountLabel->setCaption("[Particle count: " + + toString(Particle::particleCount) + +"]"); + mParticleCountLabel->adjustSize(); } void diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index 4fd33d83..d082b2ca 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -58,6 +58,7 @@ class DebugWindow : public Window, public gcn::ActionListener private: gcn::Label *mMusicFileLabel, *mMapFileLabel; gcn::Label *mTileMouseLabel, *mFPSLabel; + gcn::Label *mParticleCountLabel; }; #endif diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 44d042a6..2018c75a 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -165,8 +165,8 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) if (!item) return; - /* Convert relative to the window coordinates to - * absolute screen coordinates. + /* Convert relative to the window coordinates to absolute screen + * coordinates. */ int mx = event.getX() + getX(); int my = event.getY() + getY(); @@ -178,7 +178,8 @@ void InventoryWindow::mouseDragged(gcn::MouseEvent &event) { int tmpWidth = getWidth(), tmpHeight = getHeight(); Window::mouseDragged(event); - if (getWidth() != tmpWidth || getHeight() != tmpHeight) { + if (getWidth() != tmpWidth || getHeight() != tmpHeight) + { updateWidgets(); } } diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index c9878c84..478371b1 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -88,7 +88,7 @@ SellDialog::SellDialog(): quitButton->setPosition(208, 186); mShopItemList->setActionEventId("item"); - mSlider->setActionEventId("mSlider"); + mSlider->setActionEventId("slider"); mShopItemList->setPriceCheck(false); @@ -119,20 +119,11 @@ void SellDialog::reset() { mShopItems->clear(); mSlider->setValue(0.0); - mAmountItems = 0; - - mQuantityLabel->setCaption("0"); - mQuantityLabel->adjustSize(); - mMoneyLabel->setCaption("Money: 0 GP / Total: " - + toString(mPlayerMoney) + " GP"); - mMoneyLabel->adjustSize(); - mItemDescLabel->setCaption(""); - mItemEffectLabel->setCaption(""); - // Reset Previous Selected Items to prevent failing asserts + // Reset previous selected item to prevent failing asserts mShopItemList->setSelected(-1); - mIncreaseButton->setEnabled(false); - mDecreaseButton->setEnabled(false); + + updateButtonsAndLabels(); } void SellDialog::addItem(Item *item, int price) @@ -162,25 +153,7 @@ void SellDialog::action(const gcn::ActionEvent &event) { mAmountItems = 0; mSlider->setValue(0); - mDecreaseButton->setEnabled(false); - mSellButton->setEnabled(false); - - mQuantityLabel->adjustSize(); - mMoneyLabel->setCaption("Money: 0 GP / Total: " - + toString(mPlayerMoney) + " GP"); - mMoneyLabel->adjustSize(); - - if (selectedItem > -1) { - mSlider->setEnabled(true); - mIncreaseButton->setEnabled(true); - mMaxItems = mShopItems->at(selectedItem).quantity; - mQuantityLabel->setCaption("0 / " + toString(mMaxItems)); - } else { - mSlider->setEnabled(false); - mIncreaseButton->setEnabled(false); - mQuantityLabel->setCaption("0"); - } - mQuantityLabel->adjustSize(); + updateButtonsAndLabels(); } else if (event.getId() == "quit") { @@ -189,40 +162,35 @@ void SellDialog::action(const gcn::ActionEvent &event) } // The following actions require a valid item selection - if (selectedItem == -1 || selectedItem >= int(mShopItems->getNumberOfElements())) { + if (selectedItem == -1 || + selectedItem >= (int) mShopItems->getNumberOfElements()) + { return; } - bool updateButtonsAndLabels = false; - - if (event.getId() == "mSlider") + if (event.getId() == "slider") { - mAmountItems = (int)(mSlider->getValue() * mMaxItems); - - updateButtonsAndLabels = true; + mAmountItems = (int) (mSlider->getValue() * mMaxItems); + updateButtonsAndLabels(); } - else if (event.getId() == "+") + else if (event.getId() == "+" && mAmountItems < mMaxItems) { - assert(mAmountItems < mMaxItems); mAmountItems++; - mSlider->setValue(double(mAmountItems)/double(mMaxItems)); - updateButtonsAndLabels = true; + mSlider->setValue((double) mAmountItems /(double) mMaxItems); + updateButtonsAndLabels(); } - else if (event.getId() == "-") + else if (event.getId() == "-" && mAmountItems > 0) { - assert(mAmountItems > 0); mAmountItems--; - mSlider->setValue(double(mAmountItems)/double(mMaxItems)); - - updateButtonsAndLabels = true; + mSlider->setValue((double) mAmountItems / (double) mMaxItems); + updateButtonsAndLabels(); } - else if (event.getId() == "sell") + else if (event.getId() == "sell" && mAmountItems > 0 + && mAmountItems <= mMaxItems) { // Attempt sell - assert(mAmountItems > 0 && mAmountItems <= mMaxItems); - // XXX Convert for new server /* MessageOut outMsg(CMSG_NPC_SELL_REQUEST); @@ -236,60 +204,77 @@ void SellDialog::action(const gcn::ActionEvent &event) mPlayerMoney += (mAmountItems * mShopItems->at(selectedItem).price); mAmountItems = 0; mSlider->setValue(0); - mSlider->setEnabled(mMaxItems != 0); - - // All were sold - if (!mMaxItems) { + if (!mMaxItems) + { + // All were sold mShopItemList->setSelected(-1); - mShopItems->getShop()->erase(mShopItems->getShop()->begin() + selectedItem); + mShopItems->getShop()->erase( + mShopItems->getShop()->begin() + selectedItem); + } + else + { + // Update only when there are items left, the entry doesn't exist + // otherwise and can't be updated + updateButtonsAndLabels(); } - - // Update only when there are items left, the entry doesn't exist - // otherwise and can't be updated - updateButtonsAndLabels = bool(mMaxItems); - } - - // If anything changed, we need to update the buttons and labels - if (updateButtonsAndLabels) - { - // Update labels - mQuantityLabel->setCaption(toString(mAmountItems) + " / " + toString(mMaxItems)); - mQuantityLabel->adjustSize(); - - int price = mAmountItems * mShopItems->at(selectedItem).price; - mMoneyLabel->setCaption("Money: " + toString(price) + " GP / Total: " - + toString(price + mPlayerMoney) + " GP"); - mMoneyLabel->adjustSize(); - - // Update Buttons - mSellButton->setEnabled(mAmountItems > 0); - mDecreaseButton->setEnabled(mAmountItems > 0); - mIncreaseButton->setEnabled(mAmountItems < mMaxItems); } } void SellDialog::selectionChanged(const SelectionEvent &event) +{ + // Reset amount of items and update labels + mAmountItems = 0; + mSlider->setValue(0); + + updateButtonsAndLabels(); +} + +void SellDialog::setMoney(int amount) +{ + mPlayerMoney = amount; + mShopItemList->setPlayersMoney(amount); +} + +void +SellDialog::updateButtonsAndLabels() { int selectedItem = mShopItemList->getSelected(); + int income = 0; if (selectedItem > -1) { - const ItemInfo &info = - ItemDB::get(mShopItems->at(selectedItem).id); + mMaxItems = mShopItems->at(selectedItem).quantity; + if (mAmountItems > mMaxItems) + { + mAmountItems = mMaxItems; + } + income = mAmountItems * mShopItems->at(selectedItem).price; + + const ItemInfo &info = ItemDB::get(mShopItems->at(selectedItem).id); mItemDescLabel->setCaption("Description: " + info.getDescription()); mItemEffectLabel->setCaption("Effect: " + info.getEffect()); } else { - mItemDescLabel->setCaption("Description"); - mItemEffectLabel->setCaption("Effect"); + mMaxItems = 0; + mAmountItems = 0; + mItemDescLabel->setCaption("Description:"); + mItemEffectLabel->setCaption("Effect:"); } -} -void SellDialog::setMoney(int amount) -{ - mPlayerMoney = amount; - mShopItemList->setPlayersMoney(amount); + // Update Buttons and slider + mSellButton->setEnabled(mAmountItems > 0); + mDecreaseButton->setEnabled(mAmountItems > 0); + mIncreaseButton->setEnabled(mAmountItems < mMaxItems); + mSlider->setEnabled(selectedItem > -1); + + // Update the quantity and money labels + mQuantityLabel->setCaption( + toString(mAmountItems) + " / " + toString(mMaxItems)); + mQuantityLabel->adjustSize(); + mMoneyLabel->setCaption("Money: " + toString(income) + " GP / Total: " + + toString(mPlayerMoney + income) + " GP"); + mMoneyLabel->adjustSize(); } diff --git a/src/gui/sell.h b/src/gui/sell.h index 68bd7b8b..b8385a6f 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -82,6 +82,12 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener */ void setMoney(int amount); + /** + * Updates the state of buttons and labels. + */ + void + updateButtonsAndLabels(); + private: gcn::Button *mSellButton; gcn::Button *mIncreaseButton; diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index d8130cd3..ed75e5b3 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -157,6 +157,7 @@ void UpdaterWindow::setLabel(const std::string &str) void UpdaterWindow::enable() { + mCancelButton->setEnabled(false); mPlayButton->setEnabled(true); mPlayButton->requestFocus(); } @@ -168,11 +169,7 @@ void UpdaterWindow::action(const gcn::ActionEvent &event) // Register the user cancel mUserCancel = true; // Skip the updating process - if (mDownloadStatus == UPDATE_COMPLETE) - { - state = STATE_EXIT; - } - else + if (mDownloadStatus != UPDATE_COMPLETE) { mDownloadStatus = UPDATE_ERROR; } diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index f3e9031c..2af1d960 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -41,10 +41,13 @@ #include "../resources/animation.h" #include "../resources/monsterinfo.h" #include "../resources/resourcemanager.h" +#include "../resources/image.h" #include "../resources/imageset.h" #include "../utils/tostring.h" +#include + Viewport::Viewport(): mMap(0), mViewX(0.0f), @@ -67,37 +70,62 @@ Viewport::Viewport(): mPopupMenu = new PopupMenu(); // Load target cursors + loadTargetCursor("graphics/gui/target-cursor-blue-s.png", 44, 35, + false, Being::TC_SMALL); + loadTargetCursor("graphics/gui/target-cursor-red-s.png", 44, 35, + true, Being::TC_SMALL); + loadTargetCursor("graphics/gui/target-cursor-blue-m.png", 62, 44, + false, Being::TC_MEDIUM); + loadTargetCursor("graphics/gui/target-cursor-red-m.png", 62, 44, + true, Being::TC_MEDIUM); + loadTargetCursor("graphics/gui/target-cursor-blue-l.png", 82, 60, + false, Being::TC_LARGE); + loadTargetCursor("graphics/gui/target-cursor-red-l.png", 82, 60, + true, Being::TC_LARGE); +} + +void +Viewport::loadTargetCursor(std::string filename, int width, int height, + bool outRange, Being::TargetCursorSize size) +{ + assert(size > -1); + assert(size < 3); + + ImageSet* currentImageSet; + SimpleAnimation* currentCursor; + ResourceManager *resman = ResourceManager::getInstance(); - mInRangeImages = resman->getImageSet( - "graphics/gui/target-cursor-blue.png", 44, 35); - mOutRangeImages = resman->getImageSet( - "graphics/gui/target-cursor-red.png", 44, 35); - Animation *animInRange = new Animation(); - Animation *animOutRange = new Animation(); - - for (unsigned int i = 0; i < mInRangeImages->size(); ++i) + + currentImageSet = resman->getImageSet(filename, width, height); + Animation *anim = new Animation(); + for (unsigned int i = 0; i < currentImageSet->size(); ++i) { - animInRange->addFrame(mInRangeImages->get(i), 75, 0, 0); + anim->addFrame(currentImageSet->get(i), 75, 0, 0); } + currentCursor = new SimpleAnimation(anim); - for (unsigned int j = 0; j < mOutRangeImages->size(); ++j) + if (outRange) { - animOutRange->addFrame(mOutRangeImages->get(j), 75, 0, 0); + mOutRangeImages[size] = currentImageSet; + mTargetCursorOutRange[size] = currentCursor; + } + else { + mInRangeImages[size] = currentImageSet; + mTargetCursorInRange[size] = currentCursor; } - - mTargetCursorInRange = new SimpleAnimation(animInRange); - mTargetCursorOutRange = new SimpleAnimation(animOutRange); } Viewport::~Viewport() { delete mPopupMenu; - delete mTargetCursorInRange; - delete mTargetCursorOutRange; - - mInRangeImages->decRef(); - mOutRangeImages->decRef(); + for (int i = Being::TC_SMALL; i < Being::NUM_TC; i++) + { + delete mTargetCursorInRange[i]; + delete mTargetCursorOutRange[i]; + mInRangeImages[i]->decRef(); + mOutRangeImages[i]->decRef(); + } } void @@ -259,8 +287,11 @@ Viewport::logic() mWalkTime = player_node->mWalkTime; } - mTargetCursorInRange->update(10); - mTargetCursorOutRange->update(10); + for (int i = 0; i < 3; i++) + { + mTargetCursorInRange[i]->update(10); + mTargetCursorOutRange[i]->update(10); + } } void @@ -270,26 +301,31 @@ Viewport::drawTargetCursor(Graphics *graphics) Being *target = player_node->getTarget(); if (target) { + // Calculate target circle position + // Find whether target is in range int rangeX = abs(target->mX - player_node->mX); int rangeY = abs(target->mY - player_node->mY); int attackRange = player_node->getAttackRange(); - // Draw the target cursor, which one depends if the target is in range + // Get the correct target cursors graphic + Being::TargetCursorSize cursorSize = target->getTargetCursorSize(); + Image* targetCursor; if (rangeX > attackRange || rangeY > attackRange) { - // Draw the out of range cursor - graphics->drawImage(mTargetCursorOutRange->getCurrentImage(), - target->getPixelX() - mCameraX, - target->getPixelY() - mCameraY); + targetCursor = mTargetCursorOutRange[cursorSize]->getCurrentImage(); } - else - { - // Draw the in range cursor - graphics->drawImage(mTargetCursorInRange->getCurrentImage(), - target->getPixelX() - mCameraX, - target->getPixelY() - mCameraY); + else { + targetCursor = mTargetCursorInRange[cursorSize]->getCurrentImage(); } + + // Draw the target cursor at the correct position + int posX = target->getPixelX() + 16 - + targetCursor->getWidth() / 2 - mCameraX; + int posY = target->getPixelY() + 16 - + targetCursor->getHeight() / 2 - mCameraY; + + graphics->drawImage(targetCursor, posX, posY); } } @@ -304,10 +340,10 @@ Viewport::drawTargetName(Graphics *graphics) graphics->setColor(gcn::Color(255, 32, 32)); const MonsterInfo &mi = static_cast(target)->getInfo(); - graphics->drawText(mi.getName(), - target->getPixelX() - mCameraX + 15, - target->getPixelY() - mCameraY - 42, - gcn::Graphics::CENTER); + int posX = target->getPixelX() + 16 - mCameraX; + int posY = target->getPixelY() + 16 - target->getHeight() - mCameraY; + + graphics->drawText(mi.getName(), posX, posY, gcn::Graphics::CENTER); } } diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 84efeff3..22d0f249 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -29,9 +29,9 @@ #include "windowcontainer.h" #include "../configlistener.h" +#include "../being.h" class Map; -class Being; class FloorItem; class ImageSet; class Item; @@ -141,6 +141,13 @@ class Viewport : public WindowContainer, public gcn::MouseListener, */ void showPopup(int x, int y, Being *being); + /** + * Helper function for loading target cursors + */ + void + loadTargetCursor(std::string filename, int width, int height, + bool outRange, Being::TargetCursorSize size); + /** * Draws range based target cursor */ @@ -164,14 +171,17 @@ class Viewport : public WindowContainer, public gcn::MouseListener, int mCameraY; /**< Current viewpoint in tiles. */ bool mShowDebugPath; /**< Show a path from player to pointer. */ - ImageSet *mInRangeImages; /**< Images of in range target cursor. */ - ImageSet *mOutRangeImages; /**< Images of out of range target cursor.*/ + /** Images of in range target cursor. */ + ImageSet *mInRangeImages[Being::NUM_TC]; + + /** Images of out of range target cursor. */ + ImageSet *mOutRangeImages[Being::NUM_TC]; /** Animated in range target cursor. */ - SimpleAnimation *mTargetCursorInRange; + SimpleAnimation *mTargetCursorInRange[Being::NUM_TC]; /** Animated out of range target cursor. */ - SimpleAnimation *mTargetCursorOutRange; + SimpleAnimation *mTargetCursorOutRange[Being::NUM_TC]; bool mPlayerFollowMouse; int mWalkTime; diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp new file mode 100644 index 00000000..50a6fce4 --- /dev/null +++ b/src/gui/widgets/resizegrip.cpp @@ -0,0 +1,65 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "resizegrip.h" + +#include + +#include "../../graphics.h" + +#include "../../resources/image.h" +#include "../../resources/resourcemanager.h" + +Image *ResizeGrip::gripImage = 0; +int ResizeGrip::mInstances = 0; + +ResizeGrip::ResizeGrip() +{ + if (mInstances == 0) + { + // Load the grip image + ResourceManager *resman = ResourceManager::getInstance(); + gripImage = resman->getImage("graphics/gui/resize.png"); + } + + mInstances++; + + setWidth(gripImage->getWidth() + 2); + setHeight(gripImage->getHeight() + 2); +} + +ResizeGrip::~ResizeGrip() +{ + mInstances--; + + if (mInstances == 0) + { + gripImage->decRef(); + } +} + +void +ResizeGrip::draw(gcn::Graphics *graphics) +{ + dynamic_cast(graphics)->drawImage(gripImage, 0, 0); +} diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h new file mode 100644 index 00000000..04be3db3 --- /dev/null +++ b/src/gui/widgets/resizegrip.h @@ -0,0 +1,61 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_RESIZEGRIP_H +#define _TMW_RESIZEGRIP_H + +#include + +class Image; + +/** + * Resize grip. The resize grip is part of a resizable Window. It relies on the + * fact that uncaught mouse events are automatically routed to the parent + * window. + * + * \ingroup GUI + */ +class ResizeGrip : public gcn::Widget +{ + public: + /** + * Constructor. + */ + ResizeGrip(); + + /** + * Destructor. + */ + ~ResizeGrip(); + + /** + * Draws the resize grip. + */ + void draw(gcn::Graphics *graphics); + + private: + static Image *gripImage; /**< Resize grip image */ + static int mInstances; /**< Number of resize grip instances */ +}; + +#endif diff --git a/src/gui/window.cpp b/src/gui/window.cpp index bb60c6ff..8a052bba 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -24,10 +24,13 @@ #include "window.h" #include +#include #include "gccontainer.h" #include "windowcontainer.h" +#include "widgets/resizegrip.h" + #include "../configlistener.h" #include "../configuration.h" #include "../graphics.h" @@ -36,11 +39,10 @@ #include "../resources/image.h" #include "../resources/resourcemanager.h" -ConfigListener *Window::windowConfigListener = NULL; -WindowContainer *Window::windowContainer = NULL; +ConfigListener *Window::windowConfigListener = 0; +WindowContainer *Window::windowContainer = 0; int Window::instances = 0; ImageRect Window::border; -Image *Window::resizeGrip; class WindowConfigListener : public ConfigListener { @@ -54,16 +56,16 @@ class WindowConfigListener : public ConfigListener Window::Window(const std::string& caption, bool modal, Window *parent): gcn::Window(caption), + mGrip(0), mParent(parent), mWindowName("window"), - mSnapSize(8), mShowTitle(true), mModal(modal), mResizable(false), - mMouseResize(false), + mMouseResize(0), mSticky(false), mMinWinWidth(100), - mMinWinHeight(28), + mMinWinHeight(40), mMaxWinWidth(INT_MAX), mMaxWinHeight(INT_MAX) { @@ -87,7 +89,6 @@ Window::Window(const std::string& caption, bool modal, Window *parent): border.grid[6] = dBorders->getSubImage(0, 15, 4, 4); border.grid[7] = dBorders->getSubImage(4, 15, 3, 4); border.grid[8] = dBorders->getSubImage(7, 15, 4, 4); - resizeGrip = resman->getImage("graphics/gui/resize.png"); dBorders->decRef(); windowConfigListener = new WindowConfigListener(); // Send GUI alpha changed for initialization @@ -151,10 +152,10 @@ Window::~Window() delete border.grid[6]; delete border.grid[7]; delete border.grid[8]; - resizeGrip->decRef(); } delete mChrome; + delete mGrip; } void Window::setWindowContainer(WindowContainer *wc) @@ -162,22 +163,15 @@ void Window::setWindowContainer(WindowContainer *wc) windowContainer = wc; } -void Window::draw(gcn::Graphics* graphics) +void Window::draw(gcn::Graphics *graphics) { - Graphics *g = (Graphics*)graphics; + Graphics *g = static_cast(graphics); g->drawImageRect(0, 0, getWidth(), getHeight(), border); - // Draw grip - if (mResizable) - { - g->drawImage(Window::resizeGrip, - getWidth() - resizeGrip->getWidth(), - getHeight() - resizeGrip->getHeight()); - } - // Draw title - if (mShowTitle) { + if (mShowTitle) + { graphics->setFont(getFont()); graphics->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT); } @@ -188,13 +182,13 @@ void Window::draw(gcn::Graphics* graphics) void Window::setContentWidth(int width) { mChrome->setWidth(width); - resizeToContent(); + setWidth(width + 2 * getPadding()); } void Window::setContentHeight(int height) { mChrome->setHeight(height); - resizeToContent(); + setHeight(height + getPadding() + getTitleBarHeight()); } void Window::setContentSize(int width, int height) @@ -203,6 +197,37 @@ void Window::setContentSize(int width, int height) setContentHeight(height); } +void Window::setWidth(int width) +{ + gcn::Window::setWidth(width); + + if (mGrip) + { + mGrip->setX(getWidth() - mGrip->getWidth() - getChildrenArea().x); + } +} + +void Window::setHeight(int height) +{ + gcn::Window::setHeight(height); + + if (mGrip) + { + mGrip->setY(getHeight() - mGrip->getHeight() - getChildrenArea().y); + } +} + +void Window::setDimension(const gcn::Rectangle &dimension) +{ + gcn::Window::setDimension(dimension); + + if (mGrip) + { + mGrip->setX(getWidth() - mGrip->getWidth() - getChildrenArea().x); + mGrip->setY(getHeight() - mGrip->getHeight() - getChildrenArea().y); + } +} + void Window::setLocationRelativeTo(gcn::Widget *widget) { int wx, wy; @@ -238,6 +263,19 @@ void Window::setMaxHeight(unsigned int height) void Window::setResizable(bool r) { mResizable = r; + + if (mResizable) + { + mGrip = new ResizeGrip(); + mGrip->setX(getWidth() - mGrip->getWidth() - getChildrenArea().x); + mGrip->setY(getHeight() - mGrip->getHeight() - getChildrenArea().y); + gcn::Window::add(mGrip); + } + else + { + delete mGrip; + mGrip = 0; + } } bool Window::isResizable() @@ -287,15 +325,27 @@ void Window::mousePressed(gcn::MouseEvent &event) // Let Guichan move window to top and figure out title bar drag gcn::Window::mousePressed(event); - int x = event.getX(); - int y = event.getY(); + const int x = event.getX(); + const int y = event.getY(); + mMouseResize = 0; - // Activate resizing if the left mouse button was pressed on the grip - mMouseResize = - isResizable() && - event.getButton() == gcn::MouseEvent::LEFT && - getGripDimension().isPointInRect(x, y) && - !getChildrenArea().isPointInRect(x, y); + // Activate resizing handles as appropriate + if (event.getSource() == this && isResizable() && + event.getButton() == gcn::MouseEvent::LEFT && + !getChildrenArea().isPointInRect(x, y)) + { + mMouseResize |= (x > getWidth() - resizeBorderWidth) ? RIGHT : + (x < resizeBorderWidth) ? LEFT : 0; + mMouseResize |= (y > getHeight() - resizeBorderWidth) ? BOTTOM : + (y < resizeBorderWidth) ? TOP : 0; + } + else if (event.getSource() == mGrip) + { + mDragOffsetX = x + mGrip->getX(); + mDragOffsetY = y + mGrip->getY(); + mMouseResize |= BOTTOM | RIGHT; + mIsMoving = false; + } } void Window::mouseDragged(gcn::MouseEvent &event) @@ -303,20 +353,47 @@ void Window::mouseDragged(gcn::MouseEvent &event) // Let Guichan handle title bar drag gcn::Window::mouseDragged(event); - // Keep guichan window inside screen - int newX = std::max(0, getX()); - int newY = std::max(0, getY()); - newX = std::min(windowContainer->getWidth() - getWidth(), newX); - newY = std::min(windowContainer->getHeight() - getHeight(), newY); - setPosition(newX, newY); + // Keep guichan window inside screen when it may be moved + if (isMovable() && mIsMoving) + { + int newX = std::max(0, getX()); + int newY = std::max(0, getY()); + newX = std::min(windowContainer->getWidth() - getWidth(), newX); + newY = std::min(windowContainer->getHeight() - getHeight(), newY); + setPosition(newX, newY); + } if (mMouseResize && !mIsMoving) { + const int dx = event.getX() - mDragOffsetX + + ((event.getSource() == mGrip) ? mGrip->getX() : 0); + const int dy = event.getY() - mDragOffsetY + + ((event.getSource() == mGrip) ? mGrip->getY() : 0); gcn::Rectangle newDim = getDimension(); - // We're dragging bottom right - newDim.width += event.getX() - mDragOffsetX; - newDim.height += event.getY() - mDragOffsetY; + if (mMouseResize & (TOP | BOTTOM)) + { + int newHeight = newDim.height + ((mMouseResize & TOP) ? -dy : dy); + newDim.height = std::min(mMaxWinHeight, + std::max(mMinWinHeight, newHeight)); + + if (mMouseResize & TOP) + { + newDim.y -= newDim.height - getHeight(); + } + } + + if (mMouseResize & (LEFT | RIGHT)) + { + int newWidth = newDim.width + ((mMouseResize & LEFT) ? -dx : dx); + newDim.width = std::min(mMaxWinWidth, + std::max(mMinWinWidth, newWidth)); + + if (mMouseResize & LEFT) + { + newDim.x -= newDim.width - getWidth(); + } + } // Keep guichan window inside screen (supports resizing any side) if (newDim.x < 0) @@ -338,29 +415,16 @@ void Window::mouseDragged(gcn::MouseEvent &event) newDim.height = windowContainer->getHeight() - newDim.y; } - // Keep the window at least its minimum size - if (newDim.width < mMinWinWidth) - { - newDim.width = mMinWinWidth; - } - else if (newDim.width > mMaxWinWidth) - { - newDim.width = mMaxWinWidth; - } - - if (newDim.height < mMinWinHeight) + // Update mouse offset when dragging bottom or right border + if (mMouseResize & BOTTOM) { - newDim.height = mMinWinHeight; + mDragOffsetY += newDim.height - getHeight(); } - else if (newDim.height > mMaxWinHeight) + if (mMouseResize & RIGHT) { - newDim.height = mMaxWinHeight; + mDragOffsetX += newDim.width - getWidth(); } - // Update mouse offset when dragging bottom or right border - mDragOffsetX += newDim.width - getWidth(); - mDragOffsetY += newDim.height - getHeight(); - // Set the new window and content dimensions setDimension(newDim); const gcn::Rectangle area = getChildrenArea(); @@ -368,15 +432,6 @@ void Window::mouseDragged(gcn::MouseEvent &event) } } -gcn::Rectangle -Window::getGripDimension() -{ - return gcn::Rectangle(getWidth() - resizeGrip->getWidth(), - getHeight() - resizeGrip->getHeight(), - getWidth(), - getHeight()); -} - void Window::loadWindowState() { diff --git a/src/gui/window.h b/src/gui/window.h index 31c260cf..03248908 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -30,11 +30,10 @@ class ConfigListener; class GCContainer; -class Image; class ImageRect; +class ResizeGrip; class WindowContainer; - /** * A window. This window can be dragged around and has a title bar. Windows are * invisible by default. @@ -99,6 +98,21 @@ class Window : public gcn::Window */ void setContentSize(int width, int height); + /** + * Sets the width of this window. + */ + void setWidth(int width); + + /** + * Sets the height of this window. + */ + void setHeight(int height); + + /** + * Sets the position and size of this window. + */ + void setDimension(const gcn::Rectangle &dimension); + /** * Sets the location relative to the given widget. */ @@ -168,16 +182,15 @@ class Window : public gcn::Window void scheduleDelete(); /** - * Window dragging and resizing mouse related. These methods also makes - * sure the window is not dragged/resized outside of the screen. + * Starts window resizing when appropriate. */ void mousePressed(gcn::MouseEvent &event); - void mouseDragged(gcn::MouseEvent &event); /** - * Gets the position of the resize grip. + * Implements window resizing and makes sure the window is not + * dragged/resized outside of the screen. */ - gcn::Rectangle getGripDimension(); + void mouseDragged(gcn::MouseEvent &event); /** * Sets the name of the window. This is not the window title. @@ -214,37 +227,50 @@ class Window : public gcn::Window */ virtual void resetToDefaultSize(); + enum ResizeHandles + { + TOP = 0x01, + RIGHT = 0x02, + BOTTOM = 0x04, + LEFT = 0x08 + }; + protected: - GCContainer *mChrome; /**< Contained container */ + GCContainer *mChrome; /**< Contained container */ + ResizeGrip *mGrip; /**< Resize grip */ Window *mParent; /**< The parent window */ std::string mWindowName; /**< Name of the window */ - int mSnapSize; /**< Snap distance to window edge */ bool mShowTitle; /**< Window has a title bar */ bool mModal; /**< Window is modal */ - bool mResizable; /**< Window can be resized */ - bool mMouseResize; /**< Window is being resized */ - bool mSticky; /**< Window resists minimzation */ - int mMinWinWidth; /**< Minimum window width */ - int mMinWinHeight; /**< Minimum window height */ - int mMaxWinWidth; /**< Maximum window width */ - int mMaxWinHeight; /**< Maximum window height */ + bool mResizable; /**< Window can be resized */ + int mMouseResize; /**< Window is being resized */ + bool mSticky; /**< Window resists minimization */ + int mMinWinWidth; /**< Minimum window width */ + int mMinWinHeight; /**< Minimum window height */ + int mMaxWinWidth; /**< Maximum window width */ + int mMaxWinHeight; /**< Maximum window height */ int mDefaultX; /**< Default window X position */ int mDefaultY; /**< Default window Y position */ int mDefaultWidth; /**< Default window width */ int mDefaultHeight; /**< Default window height */ /** The window container windows add themselves to. */ - static WindowContainer* windowContainer; + static WindowContainer *windowContainer; /** - * The config listener that listens to changes relevant to all - * windows + * The config listener that listens to changes relevant to all windows. */ static ConfigListener *windowConfigListener; static int instances; /**< Number of Window instances */ static ImageRect border; /**< The window border and background */ - static Image *resizeGrip; /**< The grip to resize window */ + + /** + * The width of the resize border. Is independent of the actual window + * border width, and determines mostly the size of the corner area + * where two borders are moved at the same time. + */ + static const int resizeBorderWidth = 10; }; #endif diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp new file mode 100644 index 00000000..35cc21ad --- /dev/null +++ b/src/imageparticle.cpp @@ -0,0 +1,69 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "imageparticle.h" + +#include "graphics.h" + +#include "resources/image.h" + +ImageParticle::ImageParticle(Map *map, Image *image): + Particle(map), + mImage(image) +{ + mImage->incRef(); +} + +ImageParticle::~ImageParticle() +{ + mImage->decRef(); +} + +void ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const +{ + if (!mAlive) + return; + + int screenX = (int) mPosX + offsetX - mImage->getWidth() / 2; + int screenY = (int) mPosY - (int) mPosZ + offsetY - mImage->getHeight()/2; + + // Check if on screen + if (screenX + mImage->getWidth() < 0 || + screenX > graphics->getWidth() || + screenY + mImage->getHeight() < 0 || + screenY > graphics->getHeight()) + { + return; + } + + float alphafactor = 1.0f; + + if (mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut) + alphafactor *= (float) mLifetimeLeft / (float) mFadeOut; + + if (mLifetimePast < mFadeIn) + alphafactor *= (float) mLifetimePast / (float) mFadeIn; + + mImage->setAlpha(alphafactor); + graphics->drawImage(mImage, screenX, screenY); +} diff --git a/src/imageparticle.h b/src/imageparticle.h new file mode 100644 index 00000000..0ad515cc --- /dev/null +++ b/src/imageparticle.h @@ -0,0 +1,61 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _IMAGEPARTICLE_H +#define _IMAGEPARTICLE_H + +#include "particle.h" + +class Image; +class Map; + +/** + * A particle that uses an image for its visualization. + */ +class ImageParticle : public Particle +{ + public: + /** + * Constructor. The image is reference counted by this particle. + * + * @param map the map this particle appears on + * @param image an Image instance, may not be NULL + */ + ImageParticle(Map *map, Image *image); + + /** + * Destructor. + */ + ~ImageParticle(); + + /** + * Draws the particle image + */ + virtual void + draw(Graphics *graphics, int offsetX, int offsetY) const; + + protected: + Image *mImage; /**< The image used for this particle. */ +}; + +#endif diff --git a/src/main.cpp b/src/main.cpp index bbbf0fd1..58c563ab 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,7 +40,7 @@ #include -#if (defined __USE_UNIX98 || defined __FreeBSD__ || defined __APPLE__) +#ifndef WIN32 #include #include #endif @@ -148,21 +148,21 @@ struct Options */ void initHomeDir() { -#if !(defined __USE_UNIX98 || defined __FreeBSD__ || defined __APPLE__) - homeDir = "."; -#else homeDir = std::string(PHYSFS_getUserDir()) + "/.tmw"; - +#if defined WIN32 + if (!CreateDirectory(homeDir.c_str(), 0) && + GetLastError() != ERROR_ALREADY_EXISTS) +#else // Checking if /home/user/.tmw folder exists. if ((mkdir(homeDir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) && (errno != EEXIST)) +#endif { std::cout << homeDir - << " can't be made, but it doesn't exist! Exiting." + << " can't be created, but it doesn't exist! Exiting." << std::endl; exit(1); } -#endif } /** @@ -236,11 +236,17 @@ void initEngine() static SDL_SysWMinfo pInfo; SDL_GetWMInfo(&pInfo); HICON icon = LoadIcon(GetModuleHandle(NULL), "A"); - SetClassLong(pInfo.window, GCL_HICON, (LONG) icon); + if (icon) + { + SetClassLong(pInfo.window, GCL_HICON, (LONG) icon); + } #else SDL_Surface *icon = IMG_Load(TMW_DATADIR "data/icons/tmw.png"); - SDL_SetAlpha(icon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); - SDL_WM_SetIcon(icon, NULL); + if (icon) + { + SDL_SetAlpha(icon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); + SDL_WM_SetIcon(icon, NULL); + } #endif ResourceManager *resman = ResourceManager::getInstance(); diff --git a/src/map.cpp b/src/map.cpp index a6beb951..ac570627 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -29,6 +29,7 @@ #include "beingmanager.h" #include "game.h" #include "graphics.h" +#include "particle.h" #include "sprite.h" #include "tileset.h" @@ -530,3 +531,25 @@ Map::findPath(int startX, int startY, int destX, int destY) return path; } + +void +Map::addParticleEffect (std::string effectFile, int x, int y) +{ + ParticleEffectData newEffect; + newEffect.file = effectFile; + newEffect.x = x; + newEffect.y = y; + particleEffects.push_back(newEffect); +} + +void +Map::initializeParticleEffects(Particle* particleEngine) +{ + for (std::list::iterator i = particleEffects.begin(); + i != particleEffects.end(); + i++ + ) + { + particleEngine->addEffect(i->file, i->x, i->y); + } +} diff --git a/src/map.h b/src/map.h index c8a6fdb3..17772847 100644 --- a/src/map.h +++ b/src/map.h @@ -32,8 +32,9 @@ class AmbientOverlay; class Graphics; class Image; -class Tileset; +class Particle; class Sprite; +class Tileset; struct PATH_NODE; @@ -185,6 +186,17 @@ class Map : public Properties void removeSprite(SpriteIterator iterator); + /** + * Adds a particle effect + */ + void addParticleEffect (std::string effectFile, int x, int y); + + /** + * Initializes all added particle effects + */ + void + initializeParticleEffects(Particle* particleEngine); + private: /** * Converts a global tile id to the Image* pointing to the associated @@ -220,10 +232,19 @@ class Map : public Properties // Pathfinding members int mOnClosedList, mOnOpenList; - //overlay Data + // Overlay Data std::list mOverlays; float mLastScrollX; float mLastScrollY; + + // Particle effect data + struct ParticleEffectData + { + std::string file; + int x; + int y; + }; + std::list particleEffects; }; #endif diff --git a/src/monster.cpp b/src/monster.cpp index bea5b7a5..768bf16a 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -93,6 +93,12 @@ Monster::handleAttack() sound.playSfx(mi.getSound(EVENT_HIT)); } +Being::TargetCursorSize +Monster::getTargetCursorSize() const +{ + return getInfo().getTargetCursorSize(); +} + const MonsterInfo& Monster::getInfo() const { diff --git a/src/monster.h b/src/monster.h index 39bbf3d7..4915520d 100644 --- a/src/monster.h +++ b/src/monster.h @@ -37,6 +37,9 @@ class Monster : public Being virtual Type getType() const; + virtual TargetCursorSize + getTargetCursorSize() const; + /** * Handles an attack of another being by this monster. Plays a hit or * miss sound when appropriate. diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 53746671..f82a0fa8 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -34,6 +34,7 @@ #include "../localplayer.h" #include "../log.h" #include "../main.h" +#include "../particle.h" #include "../sound.h" const int EMOTION_TIME = 150; /**< Duration of emotion icon */ @@ -240,13 +241,23 @@ void BeingHandler::handleMessage(MessageIn &msg) break; case SMSG_BEING_LEVELUP: - if ((Uint32) msg.readLong() == player_node->getId()) { + id = (Uint32) msg->readLong(); + + if (id == player_node->getId()) { logger->log("Level up"); sound.playSfx("sfx/levelup.ogg"); - } else { + } + else { logger->log("Someone else went level up"); } - msg.readLong(); // type + Particle *levelupFX; + if (msg->readLong() == 0) { // type + levelupFX = particleEngine->addEffect("graphics/particles/levelup.particle.xml", 0, 0); + } + else { + levelupFX = particleEngine->addEffect("graphics/particles/skillup.particle.xml", 0, 0); + } + beingManager->findBeing(id)->controlParticle(levelupFX); break; case SMSG_BEING_EMOTION: diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index ec6c1ee3..f4cda0b9 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -261,7 +261,7 @@ void OpenGLGraphics::drawPoint(int x, int y) setTexturingAndBlending(false); glBegin(GL_POINTS); - glVertex3i(x, y, 0); + glVertex2i(x, y); glEnd(); } @@ -270,12 +270,12 @@ void OpenGLGraphics::drawLine(int x1, int y1, int x2, int y2) setTexturingAndBlending(false); glBegin(GL_LINES); - glVertex3f(x1 + 0.5f, y1 + 0.5f, 0); - glVertex3f(x2 + 0.5f, y2 + 0.5f, 0); + glVertex2f(x1 + 0.5f, y1 + 0.5f); + glVertex2f(x2 + 0.5f, y2 + 0.5f); glEnd(); glBegin(GL_POINTS); - glVertex3f(x2 + 0.5f, y2 + 0.5f, 0); + glVertex2f(x2 + 0.5f, y2 + 0.5f); glEnd(); } @@ -329,10 +329,10 @@ void OpenGLGraphics::drawRectangle(const gcn::Rectangle& rect, bool filled) setTexturingAndBlending(false); glBegin(filled ? GL_QUADS : GL_LINE_LOOP); - glVertex3f(rect.x + offset, rect.y + offset, 0); - glVertex3f(rect.x + rect.width - offset, rect.y + offset, 0); - glVertex3f(rect.x + rect.width - offset, rect.y + rect.height - offset, 0); - glVertex3f(rect.x + offset, rect.y + rect.height - offset, 0); + glVertex2f(rect.x + offset, rect.y + offset); + glVertex2f(rect.x + rect.width - offset, rect.y + offset); + glVertex2f(rect.x + rect.width - offset, rect.y + rect.height - offset); + glVertex2f(rect.x + offset, rect.y + rect.height - offset); glEnd(); } @@ -344,16 +344,16 @@ void OpenGLGraphics::drawTexedQuad(int x, int y, int w, int h, // Draw a textured quad glBegin(GL_QUADS); glTexCoord2f(texX1, texY1); - glVertex3i(x, y, 0); + glVertex2i(x, y); glTexCoord2f(texX2, texY1); - glVertex3i(x + w, y, 0); + glVertex2i(x + w, y); glTexCoord2f(texX2, texY2); - glVertex3i(x + w, y + h, 0); + glVertex2i(x + w, y + h); glTexCoord2f(texX1, texY2); - glVertex3i(x, y + h, 0); + glVertex2i(x, y + h); glEnd(); } diff --git a/src/particle.cpp b/src/particle.cpp new file mode 100644 index 00000000..509c20ee --- /dev/null +++ b/src/particle.cpp @@ -0,0 +1,370 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "particle.h" + +#include + +#include "animationparticle.h" +#include "configuration.h" +#include "imageparticle.h" +#include "log.h" +#include "map.h" +#include "particleemitter.h" +#include "textparticle.h" + +#include "resources/resourcemanager.h" + +#include "utils/dtor.h" +#include "utils/fastsqrt.h" +#include "utils/xml.h" + +class Graphics; +class Image; + +int Particle::particleCount = 0; +int Particle::maxCount = 0; +int Particle::fastPhysics = 0; +int Particle::emitterSkip = 1; +const float Particle::PARTICLE_SKY = 800.0f; + +Particle::Particle(Map *map): + mAlive(true), + mPosX(0.0f), mPosY(0.0f), mPosZ(0.0f), + mLifetimeLeft(-1), + mLifetimePast(0), + mFadeOut(0), + mFadeIn(0), + mAutoDelete(true), + mMap(map), + mVectorX(0.0f), mVectorY(0.0f), mVectorZ(0.0f), + mGravity(0.0f), + mRandomnes(0), + mBounce(0.0f), + mTarget(NULL), + mAcceleration(0.0f), + mInvDieDistance(-1.0f), + mMomentum(1.0f) +{ + Particle::particleCount++; + if (mMap) setSpriteIterator(mMap->addSprite(this)); +} + + +void +Particle::setupEngine() +{ + Particle::maxCount = (int)config.getValue("particleMaxCount", 3000); + Particle::fastPhysics = (int)config.getValue("particleFastPhysics", 0); + Particle::emitterSkip = (int)config.getValue("particleEmitterSkip", 0) + 1; + disableAutoDelete(); + logger->log("Particle engine set up"); +} + +bool +Particle::update() +{ + if (!mMap) return false; + + if (mLifetimeLeft == 0) + { + mAlive = false; + } + + if (mAlive) + { + // Update child emitters + if (mLifetimePast%Particle::emitterSkip == 0) + { + for ( EmitterIterator e = mChildEmitters.begin(); + e != mChildEmitters.end(); + e++ + ) + { + Particles newParticles = (*e)->createParticles(); + for ( ParticleIterator p = newParticles.begin(); + p != newParticles.end(); + p++ + ) + { + (*p)->moveBy(mPosX, mPosY, mPosZ); + mChildParticles.push_back (*p); + } + } + } + + if (mMomentum != 1.0f) + { + mVectorX *= mMomentum; + mVectorY *= mMomentum; + mVectorZ *= mMomentum; + } + + if (mTarget && mAcceleration != 0.0f) + { + float distX = mPosX - mTarget->getPosX(); + float distY = mPosY - mTarget->getPosY(); + float distZ = mPosZ - mTarget->getPosZ(); + float invHypotenuse; + + switch(Particle::fastPhysics) + { + case 1: + invHypotenuse = fastInvSqrt( + distX * distX + distY * distY + distZ * distZ); + break; + case 2: + invHypotenuse = 2.0f / + fabs(distX) + fabs(distY) + fabs(distZ); + break; + default: + invHypotenuse = 1.0f / sqrt( + distX * distX + distY * distY + distZ * distZ); + break; + } + + if (invHypotenuse) + { + if (mInvDieDistance > 0.0f && invHypotenuse > mInvDieDistance) + { + mAlive = false; + } + float accFactor = invHypotenuse * mAcceleration; + mVectorX -= distX * accFactor; + mVectorY -= distY * accFactor; + mVectorZ -= distZ * accFactor; + } + } + + if (mRandomnes > 0) + { + mVectorX += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; + mVectorY += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; + mVectorZ += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; + } + + mVectorZ -= mGravity; + + // Update position + mPosX += mVectorX; + mPosY += mVectorY; + mPosZ += mVectorZ; + + // Update other stuff + if (mLifetimeLeft > 0) + { + mLifetimeLeft--; + } + mLifetimePast++; + + if (mPosZ > PARTICLE_SKY || mPosZ < 0.0f) + { + if (mBounce > 0.0f) + { + mPosZ *= -mBounce; + mVectorX *= mBounce; + mVectorY *= mBounce; + mVectorZ *= -mBounce; + } + else { + mAlive = false; + } + } + } + + // Update child particles + for ( ParticleIterator p = mChildParticles.begin(); + p != mChildParticles.end(); + + ) + { + if ((*p)->update()) + { + p++; + } else { + delete (*p); + p = mChildParticles.erase(p); + } + } + + if (!mAlive && mChildParticles.empty() && mAutoDelete) + { + return false; + } + + return true; +} + + +void Particle::draw(Graphics *graphics, int offsetX, int offsetY) const +{ +} + + +Particle* +Particle::addEffect(std::string particleEffectFile, int pixelX, int pixelY) +{ + Particle *newParticle = NULL; + + // XML parser initialisation stuff + int size; + ResourceManager *resman = ResourceManager::getInstance(); + char *data = (char*) resman->loadFile(particleEffectFile.c_str(), size); + + if (!data) { + logger->log("Warning: Particle engine could not find %s !", + particleEffectFile.c_str()); + return NULL; + } + + xmlDocPtr doc = xmlParseMemory(data, size); + free(data); + + if (!doc) { + logger->log("Warning: Particle engine found syntax error in %s!", + particleEffectFile.c_str()); + return NULL; + } + + xmlNodePtr rootNode = xmlDocGetRootElement(doc); + if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "effect")) + { + logger->log("Warning: %s is not a valid particle effect definition file!", + particleEffectFile.c_str()); + return NULL; + } + + // Parse particles + for_each_xml_child_node(effectChildNode, rootNode) + { + // We're only interested in particles + if (!xmlStrEqual(effectChildNode->name, BAD_CAST "particle")) + continue; + + // Determine the exact particle type + xmlNodePtr node; + + // Animation + if ((node = XML::findFirstChildByName( + effectChildNode, "animation"))) { + newParticle = new AnimationParticle(mMap, node); + } + // Image + else if ((node = XML::findFirstChildByName( + effectChildNode, "image"))) { + Image *img= resman->getImage((const char*) + node->xmlChildrenNode->content); + + newParticle = new ImageParticle(mMap, img); + } + // Other + else { + newParticle = new Particle(mMap); + } + + // Read and set the basic properties of the particle + int offsetX = XML::getProperty(effectChildNode, "position-x", 0); + int offsetY = XML::getProperty(effectChildNode, "position-y", 0); + int offsetZ = XML::getProperty(effectChildNode, "position-z", 0); + + int particleX = (int)mPosX + pixelX + offsetX; + int particleY = (int)mPosY + pixelY + offsetY; + int particleZ = (int)mPosZ + offsetZ; + + int lifetime = XML::getProperty(effectChildNode, "lifetime", -1); + + newParticle->setPosition(particleX, particleY, particleZ); + newParticle->setLifetime(lifetime); + + // Look for additional emitters for this particle + for_each_xml_child_node(emitterNode, effectChildNode) + { + if (!xmlStrEqual(emitterNode->name, BAD_CAST "emitter")) + continue; + + ParticleEmitter *newEmitter; + newEmitter = new ParticleEmitter(emitterNode, newParticle, mMap); + newParticle->addEmitter(newEmitter); + } + + mChildParticles.push_back(newParticle); + } + + return newParticle; +} + + +Particle* +Particle::addTextSplashEffect(std::string text, + int colorR, int colorG, int colorB, + gcn::Font *font, int x, int y) +{ + Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB, + font); + newParticle->setPosition(x, y, 0); + newParticle->setVector ( ((rand()%100) - 50) / 200.0f, // X vector + ((rand()%100) - 50) / 200.0f, // Y vector + ((rand()%100) / 200.0f) + 4.0f // Z vector + ); + newParticle->setGravity(0.1f); + newParticle->setBounce(0.5f); + newParticle->setLifetime(200); + newParticle->setFadeOut(100); + + mChildParticles.push_back(newParticle); + + return newParticle; +} + + +void +Particle::setMap(Map *map) +{ + mMap = map; + if (mMap) setSpriteIterator(mMap->addSprite(this)); + + // TODO: Create map emitters based on emitter data in map data +} + + +Particle::~Particle() +{ + // Remove from map sprite list + if (mMap) mMap->removeSprite(mSpriteIterator); + // Delete child emitters and child particles + clear(); + Particle::particleCount--; +} + + +void +Particle::clear() +{ + std::for_each(mChildEmitters.begin(), mChildEmitters.end(), + make_dtor(mChildEmitters)); + mChildEmitters.clear(); + + std::for_each(mChildParticles.begin(), mChildParticles.end(), + make_dtor(mChildParticles)); + mChildParticles.clear(); +} diff --git a/src/particle.h b/src/particle.h new file mode 100644 index 00000000..7a747a5f --- /dev/null +++ b/src/particle.h @@ -0,0 +1,288 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _PARTICLE_H +#define _PARTICLE_H + +#include +#include + +#include + +#include "guichanfwd.h" +#include "sprite.h" + + +class Map; +class Particle; +class ParticleEmitter; + +typedef std::list Particles; +typedef Particles::iterator ParticleIterator; +typedef std::list Emitters; +typedef Emitters::iterator EmitterIterator; + +/** + * A particle spawned by a ParticleEmitter. + */ +class Particle : public Sprite +{ + public: + static const float PARTICLE_SKY; /**< Maximum Z position of particles */ + static int fastPhysics; /**< Mode of squareroot calculation */ + static int particleCount; /**< Current number of particles */ + static int maxCount; /**< Maximum number of particles */ + static int emitterSkip; /**< Duration of pause between two emitter updates in ticks */ + + /** + * Constructor. + * + * @param map the map this particle will add itself to, may be NULL + */ + Particle(Map *map); + + /** + * Destructor. + */ + ~Particle(); + + /** + * Deletes all child particles and emitters + */ + void + clear(); + + /** + * Gives a particle the properties of an engine root particle and loads + * the particle-related config settings + */ + void + setupEngine(); + + /** + * Updates particle position, returns false when the particle should + * be deleted + */ + virtual bool + update(); + + /** + * Draws the particle image + */ + virtual void + draw(Graphics *graphics, int offsetX, int offsetY) const; + + /** + * Necessary for sorting with the other sprites + */ + virtual int + getPixelY() const + { + return (int)(mPosY + mPosZ) - 64; + }; + + /* + Basic Particle properties: + */ + + /** + * Sets the map the particle is on. + */ + void setMap(Map *map); + + /** + * Creates a child particle that hosts some emitters described in the + * particleEffectFile. + */ + Particle* + addEffect(std::string particleEffectFile, int pixelX, int pixelY); + + /** + * Creates a standalone text particle. + */ + Particle* + addTextSplashEffect(std::string text, int colorR, int colorG, int colorB, + gcn::Font *font, int x, int y); + + /** + * Adds an emitter to the particle. + */ + void + addEmitter (ParticleEmitter* emitter) + { mChildEmitters.push_back(emitter); } + + /** + * Sets the position in 3 dimensional space in pixels relative to map + */ + void + setPosition(float x, float y, float z) + { mPosX = x; mPosY = y; mPosZ = z; } + + /** + * Sets the position in 2 dimensional space in pixels relative to map + */ + void + setPosition(float x, float y) + { mPosX = x; mPosY = y; } + + float getPosX() const + { return mPosX; } + + float getPosY() const + { return mPosY; } + + float getPosZ() const + { return mPosZ; } + + /** + * Changes the particle position relative + */ + void + moveBy(float x, float y, float z) + { mPosX += x; mPosY += y; mPosZ += z; } + + /** + * Sets the time in game ticks until the particle is destroyed. + */ + void + setLifetime(int lifetime) + { mLifetimeLeft = lifetime; mLifetimePast = 0; } + + /** + * Sets the age of the pixel in game ticks where the particle has + * faded in completely + */ + void + setFadeOut (int fadeOut) + { mFadeOut = fadeOut; } + + /** + * Sets the remaining particle lifetime where the particle starts to + * fade out + */ + void + setFadeIn (int fadeIn) + { mFadeIn = fadeIn; } + + /** + * Sets the sprite iterator of the particle on the current map to make + * it easier to remove the particle from the map when it is destroyed + */ + void + setSpriteIterator(std::list::iterator spriteIterator) + { mSpriteIterator = spriteIterator; } + + /** + * Gets the sprite iterator of the particle on the current map + */ + std::list::iterator + getSpriteIterator() const + { return mSpriteIterator; } + + /** + * Sets the current velocity in 3 dimensional space + */ + void + setVector(float x, float y, float z) + { mVectorX = x; mVectorY = y; mVectorZ = z; } + + /** + * Sets the downward acceleration + */ + void + setGravity(float g) + { mGravity = g; } + + /** + * Sets the ammount of random vector changes + */ + void + setRandomnes(int r) + { mRandomnes = r; } + + /** + * Sets the ammount of velocity particles retain after + * hitting the ground. + */ + void + setBounce(float bouncieness) + { mBounce = bouncieness; } + + /** + * Makes the particle move toward another particle with a + * given acceleration and momentum + */ + void setDestination(Particle *target, float accel, float moment) + { mTarget = target; mAcceleration = accel; mMomentum = moment; } + + /** + * Sets the distance in pixel the particle can come near the target + * particle before it is destroyed. Does only make sense after a + * target particle has been set using setDestination. + */ + void setDieDistance(float dist) + { mInvDieDistance = 1.0f / dist; } + + /** + * Manually marks the particle for deletion + */ + void kill() + { mAlive = false; mAutoDelete = true; } + + /** + * After calling this function the particle will only request + * deletion when kill() is called + */ + void disableAutoDelete() + { mAutoDelete = false; } + + protected: + bool mAlive; /**< Is the particle supposed to be drawn and updated?*/ + float mPosX, mPosY, mPosZ; /**< Position in 3 dimensonal space - pixel based relative to map */ + int mLifetimeLeft; /**< Lifetime left in game ticks*/ + int mLifetimePast; /**< Age of the particle in game ticks*/ + int mFadeOut; /**< Lifetime in game ticks left where fading out begins*/ + int mFadeIn; /**< Age in game ticks where fading in is finished*/ + + private: + // generic properties + bool mAutoDelete; /**< May the particle request its deletion by the parent particle?*/ + Map *mMap; /**< Map the particle is on*/ + std::list::iterator mSpriteIterator; /**< iterator of the particle on the current map */ + Emitters mChildEmitters; /**< List of child emitters*/ + Particles mChildParticles; /**< List of particles controlled by this particle*/ + //dynamic particle + float mVectorX, mVectorY, mVectorZ; /**< Speed in 3 dimensional space in pixels per game-tick */ + float mGravity; /**< Downward acceleration in pixels per game-tick²*/ + int mRandomnes; /**< Ammount of random vector change*/ + float mBounce; /**< How much the particle bounces off when hitting the ground*/ + //follow-point particles + Particle *mTarget; /**< The particle that attracts this particle*/ + float mAcceleration; /**< Acceleration towards the target particle in pixels per game-tick²*/ + float mInvDieDistance; /**< Distance in pixels from the target particle that causes the destruction of the particle*/ + float mMomentum; /**< How much speed the particle retains after each game tick*/ +}; + +extern Particle *particleEngine; + +#endif diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp new file mode 100644 index 00000000..2387c652 --- /dev/null +++ b/src/particleemitter.cpp @@ -0,0 +1,327 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "particleemitter.h" + +#include "animationparticle.h" +#include "imageparticle.h" +#include "log.h" +#include "particle.h" + +#include "resources/animation.h" +#include "resources/image.h" +#include "resources/resourcemanager.h" +#include "resources/imageset.h" + +#include + +#define SIN45 0.707106781f +#define DEG_RAD_FACTOR 0.017453293f + +ParticleEmitter::ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *map): + mParticleImage(0) +{ + mMap = map; + mParticleTarget = target; + + //initializing default values + mParticlePosX.set(0.0f); + mParticlePosY.set(0.0f); + mParticlePosZ.set(0.0f); + mParticleAngleHorizontal.set(0.0f); + mParticleAngleVertical.set(0.0f); + mParticlePower.set(0.0f); + mParticleGravity.set(0.0f); + mParticleRandomnes.set(0); + mParticleBounce.set(0.0f); + mParticleAcceleration.set(0.0f); + mParticleDieDistance.set(-1.0f); + mParticleMomentum.set(1.0f); + mParticleLifetime.set(-1); + mParticleFadeOut.set(0); + mParticleFadeIn.set(0); + mOutput.set(1); + + for_each_xml_child_node(propertyNode, emitterNode) + { + if (xmlStrEqual(propertyNode->name, BAD_CAST "property")) + { + std::string name = XML::getProperty(propertyNode, "name", ""); + + if (name == "position-x") + { + mParticlePosX = readMinMax(propertyNode, 0.0f); + } + else if (name == "position-y") + { + + mParticlePosY = readMinMax(propertyNode, 0.0f); + } + else if (name == "position-z") + { + mParticlePosZ = readMinMax(propertyNode, 0.0f); + } + else if (name == "image") + { + std::string image = XML::getProperty(propertyNode, "value", ""); + // Don't leak when multiple images are defined + if (image != "" && !mParticleImage) + { + ResourceManager *resman = ResourceManager::getInstance(); + mParticleImage = resman->getImage(image); + } + } + else if (name == "horizontal-angle") + { + mParticleAngleHorizontal = readMinMax(propertyNode, 0.0f); + mParticleAngleHorizontal.minVal *= DEG_RAD_FACTOR; + mParticleAngleHorizontal.maxVal *= DEG_RAD_FACTOR; + } + else if (name == "vertical-angle") + { + mParticleAngleVertical = readMinMax(propertyNode, 0.0f); + mParticleAngleVertical.minVal *= DEG_RAD_FACTOR; + mParticleAngleVertical.maxVal *= DEG_RAD_FACTOR; + } + else if (name == "power") + { + mParticlePower = readMinMax(propertyNode, 0.0f); + } + else if (name == "gravity") + { + mParticleGravity = readMinMax(propertyNode, 0.0f); + } + else if (name == "randomnes") + { + mParticleRandomnes = readMinMax(propertyNode, 0); + } + else if (name == "bounce") + { + mParticleBounce = readMinMax(propertyNode, 0.0f); + } + else if (name == "lifetime") + { + mParticleLifetime = readMinMax(propertyNode, 0); + mParticleLifetime.minVal += 1; + } + else if (name == "output") + { + mOutput = readMinMax(propertyNode, 0); + mOutput.maxVal +=1; + } + else if (name == "acceleration") + { + mParticleAcceleration = readMinMax(propertyNode, 0.0f); + } + else if (name == "die-distance") + { + mParticleDieDistance = readMinMax(propertyNode, 0.0f); + } + else if (name == "momentum") + { + mParticleMomentum = readMinMax(propertyNode, 1.0f); + } + else if (name == "fade-out") + { + mParticleFadeOut = readMinMax(propertyNode, 0); + } + else if (name == "fade-in") + { + mParticleFadeIn = readMinMax(propertyNode, 0); + } + else + { + logger->log("Particle Engine: Warning, unknown emitter property \"%s\"", + name.c_str() + ); + } + } + else if (xmlStrEqual(propertyNode->name, BAD_CAST "emitter")) + { + ParticleEmitter newEmitter(propertyNode, mParticleTarget, map); + mParticleChildEmitters.push_back(newEmitter); + } + else if (xmlStrEqual(propertyNode->name, BAD_CAST "animation")) + { + ImageSet *imageset = ResourceManager::getInstance()->getImageSet( + XML::getProperty(propertyNode, "imageset", ""), + XML::getProperty(propertyNode, "width", 0), + XML::getProperty(propertyNode, "height", 0) + ); + + // Get animation frames + for_each_xml_child_node(frameNode, propertyNode) + { + int delay = XML::getProperty(frameNode, "delay", 0); + int offsetX = XML::getProperty(frameNode, "offsetX", 0); + int offsetY = XML::getProperty(frameNode, "offsetY", 0); + offsetY -= imageset->getHeight() - 32; + offsetX -= imageset->getWidth() / 2 - 16; + + if (xmlStrEqual(frameNode->name, BAD_CAST "frame")) + { + int index = XML::getProperty(frameNode, "index", -1); + + if (index < 0) + { + logger->log("No valid value for 'index'"); + continue; + } + + Image *img = imageset->get(index); + + if (!img) + { + logger->log("No image at index " + (index)); + continue; + } + + mParticleAnimation.addFrame(img, delay, offsetX, offsetY); + } + else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence")) + { + int start = XML::getProperty(frameNode, "start", -1); + int end = XML::getProperty(frameNode, "end", -1); + + if (start < 0 || end < 0) + { + logger->log("No valid value for 'start' or 'end'"); + continue; + } + + while (end >= start) + { + Image *img = imageset->get(start); + + if (!img) + { + logger->log("No image at index " + + (start)); + continue; + } + + mParticleAnimation.addFrame(img, delay, offsetX, offsetY); + start++; + } + } + else if (xmlStrEqual(frameNode->name, BAD_CAST "end")) + { + mParticleAnimation.addTerminator(); + } + } // for frameNode + } + } +} + + +ParticleEmitter::~ParticleEmitter() +{ + if (mParticleImage) + { + mParticleImage->decRef(); + } +} + + +template MinMax +ParticleEmitter::readMinMax(xmlNodePtr propertyNode, T def) +{ + MinMax retval; + + def = (T)XML::getFloatProperty(propertyNode, "value", (double)def); + retval.set ( (T)XML::getFloatProperty(propertyNode, "min", (double)def), + (T)XML::getFloatProperty(propertyNode, "max", (double)def) + ); + + return retval; +} + + +std::list +ParticleEmitter::createParticles() +{ + std::list newParticles; + + for (int i = mOutput.value(); i > 0; i--) + { + // Limit maximum particles + if (Particle::particleCount > Particle::maxCount) break; + + Particle *newParticle; + if (mParticleImage) + { + newParticle = new ImageParticle(mMap, mParticleImage); + } + else if (mParticleAnimation.getLength() > 0) + { + Animation *newAnimation = new Animation(mParticleAnimation); + newParticle = new AnimationParticle(mMap, newAnimation); + } + else + { + newParticle = new Particle(mMap); + } + + + newParticle->setPosition( + mParticlePosX.value(), + mParticlePosY.value(), + mParticlePosZ.value() + ); + + float angleH = mParticleAngleHorizontal.value(); + float angleV = mParticleAngleVertical.value(); + float power = mParticlePower.value(); + newParticle->setVector( + cos(angleH) * cos(angleV) * power, + sin(angleH) * cos(angleV) * SIN45 * power, + sin(angleV) * SIN45 * power + ); + + newParticle->setRandomnes(mParticleRandomnes.value()); + newParticle->setGravity(mParticleGravity.value()); + newParticle->setBounce(mParticleBounce.value()); + + newParticle->setDestination(mParticleTarget, + mParticleAcceleration.value(), + mParticleMomentum.value() + ); + newParticle->setDieDistance(mParticleDieDistance.value()); + + newParticle->setLifetime(mParticleLifetime.value()); + newParticle->setFadeOut(mParticleFadeOut.value()); + newParticle->setFadeIn(mParticleFadeIn.value()); + + for ( std::list::iterator i = mParticleChildEmitters.begin(); + i != mParticleChildEmitters.end(); + i++ + ) + { + newParticle->addEmitter(new ParticleEmitter(*i)); + } + + newParticles.push_back(newParticle); + } + + return newParticles; +} diff --git a/src/particleemitter.h b/src/particleemitter.h new file mode 100644 index 00000000..ca6d8622 --- /dev/null +++ b/src/particleemitter.h @@ -0,0 +1,120 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _PARTICLEEMITTER_H +#define _PARTICLEEMITTER_H + +#include + +#include "utils/xml.h" +#include "utils/minmax.h" + +#include "resources/animation.h" + +class Image; +class Map; +class Particle; + +/** + * Every Particle can have one or more particle emitters that create new + * particles when they are updated + */ +class ParticleEmitter +{ + public: + /** + * Constructor. + */ + ParticleEmitter(xmlNodePtr emitterNode, Particle *target, Map *map); + + /** + * Destructor. + */ + ~ParticleEmitter(); + + /** + * Spawns new particles + * @return: a list of created particles + */ + std::list createParticles(); + + /** + * Sets the target of the particles that are created + */ + void + setTarget(Particle *target) + { mParticleTarget = target; }; + + private: + template MinMax readMinMax(xmlNodePtr propertyNode, T def); + + /** + * initial position of particles: + */ + MinMax mParticlePosX, mParticlePosY, mParticlePosZ; + + /** + * initial vector of particles: + */ + MinMax mParticleAngleHorizontal, mParticleAngleVertical; + + /** + * Initial velocity of particles + */ + MinMax mParticlePower; + + /* + * Vector changing of particles: + */ + MinMax mParticleGravity; + MinMax mParticleRandomnes; + MinMax mParticleBounce; + + /* + * Properties of targeting particles: + */ + Particle *mParticleTarget; + MinMax mParticleAcceleration; + MinMax mParticleDieDistance; + MinMax mParticleMomentum; + + /* + * Behavior over time of the particles: + */ + MinMax mParticleLifetime; + MinMax mParticleFadeOut; + MinMax mParticleFadeIn; + + Map *mMap; /**< Map the particles are spawned on */ + + MinMax mOutput; /**< Number of particles spawned per update */ + + Image *mParticleImage; /**< Particle image, if used */ + + /** Filename of particle animation file */ + Animation mParticleAnimation; + + /** List of emitters the spawned particles are equipped with */ + std::list mParticleChildEmitters; +}; +#endif diff --git a/src/resources/animation.h b/src/resources/animation.h index d0d11c69..aad93cda 100644 --- a/src/resources/animation.h +++ b/src/resources/animation.h @@ -54,7 +54,7 @@ class Animation Animation(); /** - * Appends a new animation at the end of the sequence + * Appends a new animation at the end of the sequence. */ void addFrame(Image *image, unsigned int delay, int offsetX, int offsetY); diff --git a/src/resources/image.cpp b/src/resources/image.cpp index a27783d4..d7d4e64b 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -187,19 +187,22 @@ Image* Image::load(void *buffer, unsigned int bufferSize, bool hasAlpha = false; - // Figure out whether the image uses its alpha layer - for (int i = 0; i < tmpImage->w * tmpImage->h; ++i) + if (tmpImage->format->BitsPerPixel == 32) { - Uint8 r, g, b, a; - SDL_GetRGBA( - ((Uint32*) tmpImage->pixels)[i], - tmpImage->format, - &r, &g, &b, &a); - - if (a != 255) + // Figure out whether the image uses its alpha layer + for (int i = 0; i < tmpImage->w * tmpImage->h; ++i) { - hasAlpha = true; - break; + Uint8 r, g, b, a; + SDL_GetRGBA( + ((Uint32*) tmpImage->pixels)[i], + tmpImage->format, + &r, &g, &b, &a); + + if (a != 255) + { + hasAlpha = true; + break; + } } } diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index fda8916d..2230cb6a 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -231,6 +231,30 @@ MapReader::readMap(xmlNodePtr node, const std::string &path) { readProperties(childNode, map); } + else if (xmlStrEqual(childNode->name, BAD_CAST "objectgroup")) + { + for_each_xml_child_node(objectNode, childNode) + { + if (xmlStrEqual(objectNode->name, BAD_CAST "object")) + { + std::string objName = XML::getProperty(objectNode, "name", ""); + std::string objType = XML::getProperty(objectNode, "type", ""); + int objX = XML::getProperty(objectNode, "x", 0); + int objY = XML::getProperty(objectNode, "y", 0); + + logger->log("- Loading object name: %s type: %s at %d:%d", + objName.c_str(), objType.c_str(), objX, objY); + if (objType == "PARTICLE_EFFECT") + { + map->addParticleEffect(objName, objX, objY); + } + else + { + logger->log(" Warning: Unknown object type"); + } + } + } + } } map->initializeOverlays(); diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index ac3ac3bc..89afc549 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -83,6 +83,27 @@ MonsterDB::load() currentInfo->setName (XML::getProperty(monsterNode, "name", "unnamed")); + std::string targetCursor; + targetCursor = XML::getProperty(monsterNode, "targetCursor", "medium"); + if (targetCursor == "small") + { + currentInfo->setTargetCursorSize(Being::TC_SMALL); + } + else if (targetCursor == "medium") + { + currentInfo->setTargetCursorSize(Being::TC_MEDIUM); + } + else if (targetCursor == "large") + { + currentInfo->setTargetCursorSize(Being::TC_LARGE); + } + else + { + 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); + } + //iterate s and s for_each_xml_child_node(spriteNode, monsterNode) { diff --git a/src/resources/monsterinfo.h b/src/resources/monsterinfo.h index 05d4c014..d2a0a2c8 100644 --- a/src/resources/monsterinfo.h +++ b/src/resources/monsterinfo.h @@ -28,6 +28,9 @@ #include #include +#include "../being.h" + + enum SoundEvent { EVENT_HIT, @@ -62,7 +65,11 @@ class MonsterInfo setSprite(std::string filename) { mSprite = filename; } void - addSound (SoundEvent event, std::string filename); + setTargetCursorSize(Being::TargetCursorSize targetCursorSize) + { mTargetCursorSize = targetCursorSize; } + + void + addSound(SoundEvent event, std::string filename); const std::string& getName () const { return mName; }; @@ -70,13 +77,16 @@ class MonsterInfo const std::string& getSprite () const { return mSprite; }; + const Being::TargetCursorSize + getTargetCursorSize() const { return mTargetCursorSize; } + std::string getSound (SoundEvent event) const; private: std::string mName; std::string mSprite; - + Being::TargetCursorSize mTargetCursorSize; std::map* > mSounds; }; diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index 5fc35bcd..18e732ef 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -23,6 +23,91 @@ #include "simpleanimation.h" +#include "graphics.h" +#include "log.h" + +#include "resources/image.h" +#include "resources/resourcemanager.h" +#include "resources/imageset.h" + + +SimpleAnimation::SimpleAnimation(xmlNodePtr animationNode): + mAnimationTime(0), + mAnimationPhase(0) +{ + mAnimation = new Animation(); + + ImageSet *imageset = ResourceManager::getInstance()->getImageSet( + XML::getProperty(animationNode, "imageset", ""), + XML::getProperty(animationNode, "width", 0), + XML::getProperty(animationNode, "height", 0) + ); + + // Get animation frames + for ( xmlNodePtr frameNode = animationNode->xmlChildrenNode; + frameNode != NULL; + frameNode = frameNode->next) + { + int delay = XML::getProperty(frameNode, "delay", 0); + int offsetX = XML::getProperty(frameNode, "offsetX", 0); + int offsetY = XML::getProperty(frameNode, "offsetY", 0); + offsetY -= imageset->getHeight() - 32; + offsetX -= imageset->getWidth() / 2 - 16; + + if (xmlStrEqual(frameNode->name, BAD_CAST "frame")) + { + int index = XML::getProperty(frameNode, "index", -1); + + if (index < 0) + { + logger->log("No valid value for 'index'"); + continue; + } + + Image *img = imageset->get(index); + + if (!img) + { + logger->log("No image at index " + (index)); + continue; + } + + mAnimation->addFrame(img, delay, offsetX, offsetY); + } + else if (xmlStrEqual(frameNode->name, BAD_CAST "sequence")) + { + int start = XML::getProperty(frameNode, "start", -1); + int end = XML::getProperty(frameNode, "end", -1); + + if (start < 0 || end < 0) + { + logger->log("No valid value for 'start' or 'end'"); + continue; + } + + while (end >= start) + { + Image *img = imageset->get(start); + + if (!img) + { + logger->log("No image at index " + + (start)); + continue; + } + + mAnimation->addFrame(img, delay, offsetX, offsetY); + start++; + } + } + else if (xmlStrEqual(frameNode->name, BAD_CAST "end")) + { + mAnimation->addTerminator(); + } + } + + mCurrentFrame = mAnimation->getFrame(0); +} void SimpleAnimation::update(unsigned int timePassed) { diff --git a/src/simpleanimation.h b/src/simpleanimation.h index a56c31da..561c540d 100644 --- a/src/simpleanimation.h +++ b/src/simpleanimation.h @@ -26,7 +26,10 @@ #include "resources/animation.h" +#include "utils/xml.h" + class Frame; +class Graphics; /** * This class is a leightweight alternative to the AnimatedSprite class. @@ -35,6 +38,9 @@ class Frame; class SimpleAnimation { public: + /** + * Creates a simple animation with an already created animation. + */ SimpleAnimation(Animation *animation): mAnimation(animation), mAnimationTime(0), @@ -42,6 +48,11 @@ class SimpleAnimation mCurrentFrame(mAnimation->getFrame(0)) {}; + /** + * Creates a simple animation that creates its animation from XML Data. + */ + SimpleAnimation(xmlNodePtr animationNode); + ~SimpleAnimation(); void update(unsigned int timePassed); @@ -55,10 +66,10 @@ class SimpleAnimation /** Time in game ticks the current frame is shown. */ unsigned int mAnimationTime; - /** Index of current animation frame. */ + /** Index of current animation phase. */ unsigned int mAnimationPhase; - /** Current animation frame. */ + /** Current animation phase. */ Frame *mCurrentFrame; }; diff --git a/src/sprite.h b/src/sprite.h index 51811149..89780519 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -49,6 +49,22 @@ class Sprite 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 + { return 0; } + + /** + * Returns the vertical size of the sprites graphical representation + * in pixels or 0 when it is undefined. + */ + virtual int + getHeight() const + { return 0; } + /** * Returns the pixel Y coordinate of the sprite. */ diff --git a/src/textparticle.cpp b/src/textparticle.cpp new file mode 100644 index 00000000..dd01d2fe --- /dev/null +++ b/src/textparticle.cpp @@ -0,0 +1,64 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "textparticle.h" + +#include "graphics.h" + +TextParticle::TextParticle(Map *map, const std::string &text, + int colorR, int colorG, int colorB, gcn::Font *font): + Particle(map), + mText(text), + mTextFont(font), + mColorR(colorR), + mColorG(colorG), + mColorB(colorB) +{ +} + +void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const +{ + if (!mAlive) + return; + + int screenX = (int)mPosX + offsetX; + int screenY = (int)mPosY - int(mPosZ) + offsetY; + + int alpha = 255; + + if (mLifetimeLeft > -1 && mLifetimeLeft < mFadeOut) + { + alpha *= mLifetimeLeft; + alpha /= mFadeOut; + }; + + if (mLifetimePast < mFadeIn) + { + alpha *= mLifetimePast; + alpha /= mFadeIn; + } + + graphics->setFont(mTextFont); + graphics->setColor(gcn::Color (mColorR, mColorG, mColorB, alpha)); + graphics->drawText(mText, screenX, screenY, gcn::Graphics::CENTER); +} diff --git a/src/textparticle.h b/src/textparticle.h new file mode 100644 index 00000000..b365c885 --- /dev/null +++ b/src/textparticle.h @@ -0,0 +1,53 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TEXTPARTICLE_H +#define _TEXTPARTICLE_H + +#include "particle.h" + +#include + +#include "guichanfwd.h" + +class TextParticle : public Particle +{ + public: + TextParticle(Map *map, const std::string &text, + int colorR, int colorG, int colorB, gcn::Font *font); + /** + * Draws the particle image + */ + virtual void + draw(Graphics *graphics, int offsetX, int offsetY) const; + + // hack to improve text visibility + virtual int getPixelY() const { return (int)(mPosY + mPosZ); } + + private: + std::string mText; /**< Text of the particle */ + gcn::Font *mTextFont; /**< Font used for drawing the text */ + int mColorR, mColorG, mColorB; /**< Color used for drawing the text */ +}; + +#endif diff --git a/src/utils/fastsqrt.h b/src/utils/fastsqrt.h new file mode 100644 index 00000000..8da1d354 --- /dev/null +++ b/src/utils/fastsqrt.h @@ -0,0 +1,24 @@ +/* A very fast function to calculate the approximate inverse square root of a + * floating point value and a helper function that uses it for getting the + * normal squareroot. For an explanation of the inverse squareroot function + * read: + * http://www.math.purdue.edu/~clomont/Math/Papers/2003/InvSqrt.pdf + * + * Unfortunately the original creator of this function seems to be unknown. + */ + +float fastInvSqrt(float x) +{ + union { int i; float x; } tmp; + float xhalf = 0.5f * x; + tmp.x = x; + tmp.i = 0x5f375a86 - (tmp.i >> 1); + x = tmp.x; + x = x * (1.5f - xhalf * x * x); + return x; +} + +float fastSqrt(float x) +{ + return 1.0f / fastInvSqrt(x); +} diff --git a/src/utils/minmax.h b/src/utils/minmax.h new file mode 100644 index 00000000..1add2b7e --- /dev/null +++ b/src/utils/minmax.h @@ -0,0 +1,47 @@ +/* + * The Mana World + * Copyright 2006 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +/** + * Returns a random numeric value that is larger than or equal min and smaller + * than max + */ + +template struct MinMax +{ + void set(T min, T max) + { + minVal=min; maxVal=max; + } + + void set(T val) + { + set(val, val); + } + + T value() + { + return (T)(minVal + (maxVal - minVal) * (rand() / ((double) RAND_MAX + 1))); + } + + T minVal; + T maxVal; +}; diff --git a/src/utils/wingettimeofday.h b/src/utils/wingettimeofday.h index a5537f39..28afb7e5 100644 --- a/src/utils/wingettimeofday.h +++ b/src/utils/wingettimeofday.h @@ -1,113 +1,113 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#ifndef _TMW_WINGETTIMEOFDAY_H_ -#define _TMW_WINGETTIMEOFDAY_H_ - -#ifdef WIN32 - -#include - -/* - * the function gettimeofday() is available on UNIX but not on windows. - * this header defines a windows implementation as a - * GetSystemTimeAsFileTime() wrapper. - */ - -int gettimeofday(struct timeval* tv, void *tz) -/*--------------------------------------------------------------- - * Copyright (c) 1999,2000,2001,2002,2003 - * The Board of Trustees of the University of Illinois - * All Rights Reserved. - *--------------------------------------------------------------- - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software (Iperf) and associated - * documentation files (the "Software"), to deal in the Software - * without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit - * persons to whom the Software is furnished to do - * so, subject to the following conditions: - * - * - * Redistributions of source code must retain the above - * copyright notice, this list of conditions and - * the following disclaimers. - * - * - * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimers in the documentation and/or other materials - * provided with the distribution. - * - * - * Neither the names of the University of Illinois, NCSA, - * nor the names of its contributors may be used to endorse - * or promote products derived from this Software without - * specific prior written permission. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * ________________________________________________________________ - * National Laboratory for Applied Network Research - * National Center for Supercomputing Applications - * University of Illinois at Urbana-Champaign - * http://www.ncsa.uiuc.edu - * ________________________________________________________________ - * - * gettimeofday.c - * by Mark Gates - * ------------------------------------------------------------------- - * A (hack) implementation of gettimeofday for Windows. - * Since I send sec/usec in UDP packets, this made the most sense. - * ------------------------------------------------------------------- */ -{ - FILETIME time; - double timed; - - GetSystemTimeAsFileTime( &time ); - - // Apparently Win32 has units of 1e-7 sec (tenths of microsecs) - // 4294967296 is 2^32, to shift high word over - // 11644473600 is the number of seconds between - // the Win32 epoch 1601-Jan-01 and the Unix epoch 1970-Jan-01 - // Tests found floating point to be 10x faster than 64bit int math. - - timed = ((time.dwHighDateTime * 4294967296e-7) - 11644473600.0) + - (time.dwLowDateTime * 1e-7); - - tv->tv_sec = (long) timed; - tv->tv_usec = (long) ((timed - tv->tv_sec) * 1e6); - - return 0; -} - - -#endif // WIN32 -#endif +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_WINGETTIMEOFDAY_H_ +#define _TMW_WINGETTIMEOFDAY_H_ + +#ifdef WIN32 + +#include + +/* + * the function gettimeofday() is available on UNIX but not on windows. + * this header defines a windows implementation as a + * GetSystemTimeAsFileTime() wrapper. + */ + +int gettimeofday(struct timeval* tv, void *tz) +/*--------------------------------------------------------------- + * Copyright (c) 1999,2000,2001,2002,2003 + * The Board of Trustees of the University of Illinois + * All Rights Reserved. + *--------------------------------------------------------------- + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software (Iperf) and associated + * documentation files (the "Software"), to deal in the Software + * without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, + * sublicense, and/or sell copies of the Software, and to permit + * persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * + * Redistributions of source code must retain the above + * copyright notice, this list of conditions and + * the following disclaimers. + * + * + * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimers in the documentation and/or other materials + * provided with the distribution. + * + * + * Neither the names of the University of Illinois, NCSA, + * nor the names of its contributors may be used to endorse + * or promote products derived from this Software without + * specific prior written permission. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE CONTIBUTORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * ________________________________________________________________ + * National Laboratory for Applied Network Research + * National Center for Supercomputing Applications + * University of Illinois at Urbana-Champaign + * http://www.ncsa.uiuc.edu + * ________________________________________________________________ + * + * gettimeofday.c + * by Mark Gates + * ------------------------------------------------------------------- + * A (hack) implementation of gettimeofday for Windows. + * Since I send sec/usec in UDP packets, this made the most sense. + * ------------------------------------------------------------------- */ +{ + FILETIME time; + double timed; + + GetSystemTimeAsFileTime( &time ); + + // Apparently Win32 has units of 1e-7 sec (tenths of microsecs) + // 4294967296 is 2^32, to shift high word over + // 11644473600 is the number of seconds between + // the Win32 epoch 1601-Jan-01 and the Unix epoch 1970-Jan-01 + // Tests found floating point to be 10x faster than 64bit int math. + + timed = ((time.dwHighDateTime * 4294967296e-7) - 11644473600.0) + + (time.dwLowDateTime * 1e-7); + + tv->tv_sec = (long) timed; + tv->tv_usec = (long) ((timed - tv->tv_sec) * 1e6); + + return 0; +} + + +#endif // WIN32 +#endif diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 7c917dc0..e30450f0 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -39,6 +39,20 @@ namespace XML return ret; } + double + getFloatProperty(xmlNodePtr node, const char* name, double def) + { + double &ret = def; + + xmlChar *prop = xmlGetProp(node, BAD_CAST name); + if (prop) { + ret = atof((char*)prop); + xmlFree(prop); + } + + return ret; + } + std::string getProperty(xmlNodePtr node, const char *name, const std::string &def) { @@ -51,4 +65,13 @@ namespace XML return def; } + + xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name) + { + for_each_xml_child_node(child, parent) + if (xmlStrEqual(child->name, BAD_CAST name)) + return child; + + return NULL; + } } diff --git a/src/utils/xml.h b/src/utils/xml.h index db4c264a..ef3bad3d 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -39,11 +39,22 @@ namespace XML 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); + /** * Gets a string property from an xmlNodePtr. */ std::string getProperty(xmlNodePtr node, const char *name, const std::string &def); + + /** + * Finds the first child node with the given name + */ + xmlNodePtr findFirstChildByName(xmlNodePtr parent, const char *name); } #define for_each_xml_child_node(var, parent) \ -- cgit v1.2.3-70-g09d2 From d3e938c478570be44c497607262fe8ca7145b171 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Mon, 13 Aug 2007 20:40:16 +0000 Subject: Started conversion of buy/sell to new server. --- ChangeLog | 3 ++ src/gui/buy.cpp | 4 +-- src/gui/buy.h | 2 +- src/gui/sell.cpp | 17 ++--------- src/gui/sell.h | 2 +- src/gui/shop.cpp | 8 +++-- src/gui/shop.h | 2 +- src/net/buysellhandler.cpp | 75 +++++++++++++++++----------------------------- src/net/protocol.h | 5 +++- 9 files changed, 46 insertions(+), 72 deletions(-) (limited to 'src/gui/buy.h') diff --git a/ChangeLog b/ChangeLog index 48dbaf4f..63bbe30e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,9 @@ * po/tmw.pot, po/fr.po: Updated .po files, so that people can start translating the whole interface, almost. * po/fr.po: Updated French translation. + * src/gui/sell.cpp, src/gui/shop.cpp, src/gui/shop.h, src/gui/buy.h, + src/gui/buy.cpp, src/gui/sell.h, src/net/buysellhandler.cpp, + src/net/protocol.h: Started conversion of buy/sell to new server. 2007-08-13 Eugenio Favalli diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 2a8616f8..9ac37e96 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -128,9 +128,9 @@ void BuyDialog::reset() updateButtonsAndLabels(); } -void BuyDialog::addItem(short id, int price) +void BuyDialog::addItem(int id, int amount, int price) { - mShopItems->addItem(id, price); + mShopItems->addItem(id, amount, price); mShopItemList->adjustSize(); } diff --git a/src/gui/buy.h b/src/gui/buy.h index 7834a434..875deef9 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -68,7 +68,7 @@ class BuyDialog : public Window, public gcn::ActionListener, SelectionListener /** * Adds an item to the shop inventory. */ - void addItem(short id, int price); + void addItem(int id, int amount, int price); /** * Called when receiving actions from the widgets. diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 478371b1..53746248 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -126,22 +126,9 @@ void SellDialog::reset() updateButtonsAndLabels(); } -void SellDialog::addItem(Item *item, int price) +void SellDialog::addItem(int item, int amount, int price) { - if (!item) - return; - - ITEM_SHOP item_shop; - - item_shop.name = item->getInfo().getName() - + " (" + toString(price) + " GP)"; - item_shop.price = price; - item_shop.index = item->getInvIndex(); - item_shop.id = item->getId(); - item_shop.quantity = item->getQuantity(); - item_shop.image = item->getInfo().getImage(); - - mShopItems->push_back(item_shop); + mShopItems->addItem(item, amount, price); mShopItemList->adjustSize(); } diff --git a/src/gui/sell.h b/src/gui/sell.h index b8385a6f..fc42fd1c 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -63,7 +63,7 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener /** * Adds an item to the inventory. */ - void addItem(Item *item, int price); + void addItem(int item, int amount, int price); /** * Called when receiving actions from the widgets. diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 3d972bc2..e2fd54f2 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -40,15 +40,17 @@ std::string ShopItems::getElementAt(int i) return mItemsShop.at(i).name; } -void ShopItems::addItem(short id, int price) +void ShopItems::addItem(int id, int amount, int price) { ITEM_SHOP item_shop; + ItemInfo const &item = ItemDB::get(id); - item_shop.name = ItemDB::get(id).getName() + item_shop.name = item.getName() + " (" + toString(price) + " GP)"; item_shop.price = price; item_shop.id = id; - item_shop.image = ItemDB::get(id).getImage(); + item_shop.quantity = amount; + item_shop.image = item.getImage(); mItemsShop.push_back(item_shop); } diff --git a/src/gui/shop.h b/src/gui/shop.h index de452b5c..665e92cb 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.h @@ -50,7 +50,7 @@ class ShopItems : public gcn::ListModel /** * Adds an item and its associated picture */ - void addItem(short id, int price); + void addItem(int id, int amount, int price); /** * Convenience function for adding items diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp index 2f22b0e6..9b96ced7 100644 --- a/src/net/buysellhandler.cpp +++ b/src/net/buysellhandler.cpp @@ -44,6 +44,8 @@ extern Window *buySellDialog; BuySellHandler::BuySellHandler() { static const Uint16 _messages[] = { + GPMSG_NPC_BUY, + GPMSG_NPC_SELL, 0 }; handledMessages = _messages; @@ -51,6 +53,14 @@ BuySellHandler::BuySellHandler() void BuySellHandler::handleMessage(MessageIn &msg) { + Being *being = beingManager->findBeing(msg.readShort()); + if (!being || being->getType() != Being::NPC) + { + return; + } + + current_npc = static_cast< NPC * >(being); + switch (msg.getId()) { #if 0 @@ -62,65 +72,34 @@ void BuySellHandler::handleMessage(MessageIn &msg) buySellDialog->setVisible(true); current_npc = dynamic_cast(beingManager->findBeing(msg.readLong())); break; +#endif - case SMSG_NPC_BUY: - msg.readShort(); // length - n_items = (msg.getLength() - 4) / 11; + case GPMSG_NPC_BUY: buyDialog->reset(); buyDialog->setMoney(player_node->getMoney()); buyDialog->setVisible(true); - for (int k = 0; k < n_items; k++) + while (msg.getUnreadLength()) { - Sint32 value = msg.readLong(); - msg.readLong(); // DCvalue - msg.readByte(); // type - Sint16 itemId = msg.readShort(); - buyDialog->addItem(itemId, value); - } - break; - - case SMSG_NPC_SELL: - msg.readShort(); // length - n_items = (msg.getLength() - 4) / 10; - if (n_items > 0) { - sellDialog->setMoney(player_node->getMoney()); - sellDialog->reset(); - sellDialog->setVisible(true); - - for (int k = 0; k < n_items; k++) - { - Sint16 index = msg.readShort(); - Sint32 value = msg.readLong(); - msg.readLong(); // OCvalue - - Item *item = player_node->getInvItem(index); - if (item && !(item->isEquipped())) { - sellDialog->addItem(item, value); - } - } - } - else { - chatWindow->chatLog("Nothing to sell", BY_SERVER); - current_npc = 0; + int itemId = msg.readShort(); + int amount = msg.readShort(); + int value = msg.readShort(); + buyDialog->addItem(itemId, amount, value); } break; - case SMSG_NPC_BUY_RESPONSE: - if (msg.readByte() == 0) { - chatWindow->chatLog("Thanks for buying", BY_SERVER); - } else { - chatWindow->chatLog("Unable to buy", BY_SERVER); - } - break; + case GPMSG_NPC_SELL: + sellDialog->setMoney(player_node->getMoney()); + sellDialog->reset(); + sellDialog->setVisible(true); - case SMSG_NPC_SELL_RESPONSE: - if (msg.readByte() == 0) { - chatWindow->chatLog("Thanks for selling", BY_SERVER); - } else { - chatWindow->chatLog("Unable to sell", BY_SERVER); + while (msg.getUnreadLength()) + { + int itemId = msg.readShort(); + int amount = msg.readShort(); + int value = msg.readShort(); + sellDialog->addItem(itemId, amount, value); } break; -#endif } } diff --git a/src/net/protocol.h b/src/net/protocol.h index a524304a..6bbe7919 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.h @@ -98,11 +98,14 @@ enum { GPMSG_BEING_ATTACK = 0x0291, // W being id PGMSG_SAY = 0x02A0, // S text GPMSG_SAY = 0x02A1, // W being id, S text - GPMSG_NPC_CHOICE = 0x02B0, // W being id, B* text + GPMSG_NPC_CHOICE = 0x02B0, // W being id, { S text }* GPMSG_NPC_MESSAGE = 0x02B1, // W being id, B* text PGMSG_NPC_TALK = 0x02B2, // W being id PGMSG_NPC_TALK_NEXT = 0x02B3, // W being id PGMSG_NPC_SELECT = 0x02B4, // W being id, B choice + GPMSG_NPC_BUY = 0x02B5, // W being id, { W item id, W amount, W cost }* + GPMSG_NPC_SELL = 0x02B6, // W being id, { W item id, W amount, W cost }* + PGMSG_NPC_BUYSELL = 0x02B7, // W item id, W amount PGMSG_TRADE_REQUEST = 0x02C0, // W being id GPMSG_TRADE_REQUEST = 0x02C1, // W being id GPMSG_TRADE_START = 0x02C2, // - -- cgit v1.2.3-70-g09d2 From 1a9320fafb23940d0463e6f384713d0f99fc0c61 Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Wed, 19 Sep 2007 17:28:33 +0000 Subject: Merged 0.0 changes from revision 3362 to 3580 to trunk. --- ChangeLog | 306 ++++++++++++++++++++++++++++++- data/graphics/gui/CMakeLists.txt | 4 + data/graphics/gui/Makefile.am | 4 + data/graphics/gui/close_button.png | Bin 0 -> 650 bytes data/graphics/gui/hits_yellow.png | Bin 356 -> 894 bytes data/graphics/gui/item_shortcut_bgr.png | Bin 0 -> 1026 bytes data/graphics/gui/mouse.png | Bin 1134 -> 4508 bytes data/graphics/gui/unknown-item.png | Bin 0 -> 540 bytes data/graphics/images/login_wallpaper.png | Bin 215527 -> 643307 bytes src/CMakeLists.txt | 22 ++- src/Makefile.am | 38 ++-- src/animationparticle.cpp | 3 +- src/being.cpp | 90 ++------- src/being.h | 42 +---- src/game.cpp | 179 ++++++++++-------- src/gui/button.cpp | 20 +- src/gui/button.h | 10 +- src/gui/buy.cpp | 125 ++++++++----- src/gui/buy.h | 10 +- src/gui/char_select.cpp | 12 +- src/gui/char_select.h | 31 ++-- src/gui/chat.cpp | 10 +- src/gui/debugwindow.cpp | 14 +- src/gui/debugwindow.h | 9 +- src/gui/equipmentwindow.cpp | 1 + src/gui/gui.cpp | 45 +++-- src/gui/gui.h | 43 +++-- src/gui/inventorywindow.cpp | 13 +- src/gui/inventorywindow.h | 11 +- src/gui/itemcontainer.cpp | 4 + src/gui/itemshortcutcontainer.cpp | 224 ++++++++++++++++++++++ src/gui/itemshortcutcontainer.h | 115 ++++++++++++ src/gui/itemshortcutwindow.cpp | 74 ++++++++ src/gui/itemshortcutwindow.h | 69 +++++++ src/gui/menuwindow.cpp | 12 +- src/gui/popupmenu.cpp | 6 - src/gui/selectionlistener.h | 16 +- src/gui/sell.cpp | 127 +++++++------ src/gui/sell.h | 16 +- src/gui/setup.cpp | 10 +- src/gui/setup_keyboard.cpp | 187 +++++++++++++++++++ src/gui/setup_keyboard.h | 84 +++++++++ src/gui/shoplistbox.cpp | 20 +- src/gui/skill.cpp | 6 +- src/gui/skill.h | 1 - src/gui/status.cpp | 6 +- src/gui/status.h | 3 +- src/gui/updatewindow.cpp | 4 +- src/gui/viewport.cpp | 25 +-- src/gui/viewport.h | 13 -- src/gui/window.cpp | 198 +++++++++++++++++--- src/gui/window.h | 99 +++++++++- src/gui/windowlistener.h | 86 +++++++++ src/imageparticle.cpp | 8 +- src/itemshortcut.cpp | 87 +++++++++ src/itemshortcut.h | 130 +++++++++++++ src/keyboardconfig.cpp | 144 +++++++++++++++ src/keyboardconfig.h | 185 +++++++++++++++++++ src/localplayer.cpp | 43 ++++- src/localplayer.h | 22 +++ src/main.cpp | 19 +- src/monster.cpp | 10 +- src/net/beinghandler.cpp | 84 +++++---- src/net/chathandler.cpp | 2 + src/net/inventoryhandler.cpp | 2 + src/net/playerhandler.cpp | 3 +- src/particle.cpp | 96 +++++----- src/particle.h | 112 +++++------ src/particleemitter.cpp | 30 ++- src/player.cpp | 50 ++--- src/player.h | 3 - src/resources/equipmentdb.cpp | 156 ---------------- src/resources/equipmentdb.h | 55 ------ src/resources/equipmentinfo.h | 52 ------ src/resources/itemdb.cpp | 126 ++++++++++--- src/resources/iteminfo.cpp | 86 ++++++++- src/resources/iteminfo.h | 118 +++++++----- src/resources/mapreader.cpp | 2 +- src/resources/monsterdb.cpp | 8 +- src/resources/monsterinfo.cpp | 12 +- src/resources/monsterinfo.h | 16 +- src/resources/spritedef.h | 4 +- src/textparticle.cpp | 11 +- src/textparticle.h | 17 +- src/utils/fastsqrt.h | 2 + src/utils/minmax.h | 1 + src/utils/trim.h | 53 ++++++ src/vector.h | 134 ++++++++++++++ tools/adler32.c | 67 +++++++ 89 files changed, 3257 insertions(+), 1140 deletions(-) create mode 100644 data/graphics/gui/close_button.png create mode 100644 data/graphics/gui/item_shortcut_bgr.png create mode 100644 data/graphics/gui/unknown-item.png create mode 100644 src/gui/itemshortcutcontainer.cpp create mode 100644 src/gui/itemshortcutcontainer.h create mode 100644 src/gui/itemshortcutwindow.cpp create mode 100644 src/gui/itemshortcutwindow.h create mode 100644 src/gui/setup_keyboard.cpp create mode 100644 src/gui/setup_keyboard.h create mode 100644 src/gui/windowlistener.h create mode 100644 src/itemshortcut.cpp create mode 100644 src/itemshortcut.h create mode 100644 src/keyboardconfig.cpp create mode 100644 src/keyboardconfig.h delete mode 100644 src/resources/equipmentdb.cpp delete mode 100644 src/resources/equipmentdb.h delete mode 100644 src/resources/equipmentinfo.h create mode 100644 src/utils/trim.h create mode 100644 src/vector.h create mode 100644 tools/adler32.c (limited to 'src/gui/buy.h') diff --git a/ChangeLog b/ChangeLog index 082c9b94..d0e43d40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,19 @@ * src/gui/button.cpp: Fixed improper const qualifier. +2007-09-12 Bjørn Lindeijer + + * data/items.xml, data/equipment.xml: Added temporary weapon IDs below + 256 to use as view-ID in eAthena's item DB. + * src/gui/shoplistbox.cpp, src/gui/buy.h, src/gui/buy.cpp: Allowed + selection of items that cannot be afforded, so that their descriptions + are still accessible. Also made sure the player's money value of + ShopItemList gets updated. + +2007-09-11 Eugenio Favalli + + * src/gui/chat.cpp, tmw.cbp: Fixed admin commands. + 2007-09-10 Eugenio Favalli * configure.ac, data/fonts/dejavusans.ttf, @@ -18,17 +31,103 @@ * po/LINGUAS: Added German to the list of available languages. * po/de.po: Fixed two syntax errors preventing compilation. -2007-08-27 Matthias Hartmann +2007-09-08 Philipp Sehmisch + + * data/graphics/particles/aniblaze.png, + data/graphics/particles/cookingfire.particle.xml, + data/graphics/particles/fireplace.particle.xml, + data/graphics/particles/flame.particle.xml: Improved fire effects by + using animated particles. - * po/de.po: Added german translation. +2007-09-06 Philipp Sehmisch + + * src/animationparticle.cpp, src/imageparticle.cpp: Fixed animated + particles. + +2007-09-01 Bjørn Lindeijer + + * src/Makefile.am: Fixed the entry for windowlistener.h. + +2007-08-30 Bjørn Lindeijer + + * src/localplayer.cpp, src/player.cpp, src/main.cpp, src/being.cpp, + src/CMakeLists.txt, src/Makefile.am, src/resources/iteminfo.h, + src/resources/equipmentdb.h, src/resources/equipmentinfo.h, + src/resources/itemdb.cpp, src/resources/iteminfo.cpp, + src/resources/equipmentdb.cpp, src/resources/equipmentinfo.cpp, + src/resources/spritedef.h, src/being.h, data/items.xml, + data/equipment.xml: Merged equipment database with items database and + got rid of the unused item art attribute. + * src/net/beinghandler.cpp, src/net/charserverhandler.cpp: Removed the + now unnecessary multiplication of weapon IDs with 10000. + * src/resources/iteminfo.cpp, data/graphics/items/unknown.png: Added + fallback item icon and use it for unknown items or when item image + fails to load. + * NEWS: Updated with changes since last update. + * data/items.xml, data/equipment.xml: Reverted equipment database and + included original low-ID items in items.xml for compatibility with + eAthena, which doesn't support View ID to come above 255. + * src/resources/itemdb.cpp: Accept items without a name. + +2007-08-29 Bjørn Lindeijer + + * src/gui/sell.cpp, src/gui/inventorywindow.cpp, src/gui/sell.h: Made + sell dialog resizable and tweaked inventory resize code a bit. + * data/items.xml: Fixed typo in chainmail description. + +2007-08-28 Bjørn Lindeijer + + * src/gui/window.cpp, src/gui/inventorywindow.h, + src/gui/selectionlistener.h, src/gui/buy.h, + src/gui/itemshortcutwindow.cpp, src/gui/inventorywindow.cpp, + src/gui/buy.cpp, src/gui/window.h, src/gui/windowlistener.h, + src/gui/itemshortcutwindow.h, src/CMakeLists.txt, src/Makefile.am: + Made buy dialog resizable and added a WindowListener class for + listening for window resize and move events. + * src/textparticle.h, src/particle.h, src/CMakeLists.txt, + src/particle.cpp, src/imageparticle.cpp, src/vector.h, + src/textparticle.cpp, src/Makefile.am: Added Vector class and used it + in the particle engine. + +2007-08-27 Bjørn Lindeijer + + * src/engine.cpp, src/resources/mapreader.cpp: Made client search for + both compressed and non-compressed map files. 2007-08-27 Eugenio Favalli + * src/game.cpp: Assigned unused emotions to Alt +/-. (applied a patch + by Quiche_on_a_leash). + * data/maps/new_1-1.tmx, data/maps/new_1-1.tmx.gz, + data/maps/new_10-1.tmx, data/maps/new_10-1.tmx.gz, + data/maps/new_11-1.tmx, data/maps/new_11-1.tmx.gz, + data/maps/new_12-1.tmx, data/maps/new_12-1.tmx.gz, + data/maps/new_13-1.tmx, data/maps/new_13-1.tmx.gz, + data/maps/new_14-1.tmx, data/maps/new_14-1.tmx.gz, + data/maps/new_15-1.tmx, data/maps/new_15-1.tmx.gz, + data/maps/new_16-1.tmx, data/maps/new_16-1.tmx.gz, + data/maps/new_17-1.tmx, data/maps/new_17-1.tmx.gz, + data/maps/new_18-1.tmx, data/maps/new_18-1.tmx.gz, + data/maps/new_19-1.tmx, data/maps/new_19-1.tmx.gz, + data/maps/new_2-1.tmx, data/maps/new_2-1.tmx.gz, + data/maps/new_20-1.tmx, data/maps/new_20-1.tmx.gz, + data/maps/new_3-1.tmx, data/maps/new_3-1.tmx.gz, + data/maps/new_4-1.tmx, data/maps/new_4-1.tmx.gz, + data/maps/new_5-1.tmx, data/maps/new_5-1.tmx.gz, + data/maps/new_6-1.tmx, data/maps/new_6-1.tmx.gz, + data/maps/new_7-1.tmx, data/maps/new_7-1.tmx.gz, + data/maps/new_8-1.tmx, data/maps/new_8-1.tmx.gz, + data/maps/new_9-1.tmx, data/maps/new_9-1.tmx.gz: Replaced compressed + maps with layer compressed maps. * data/maps/new_1-1.tmx.gz: Added test npcs. * src/openglgraphics.cpp, tmw.cbp: Fixed compilation with old OpenGL headers. * po/it.po: Updated italian translation. +2007-08-27 Matthias Hartmann + + * po/de.po: Added German translation. + 2007-08-27 Guillaume Melquiond * src/gui/chat.h, src/gui/chat.cpp: Added "/admin" chat command for @@ -36,6 +135,11 @@ * src/engine.cpp, src/resources/mapreader.cpp: Ported patch from 0.0, in order to support missing extensions and uncompressed maps. +2007-08-26 Eugenio Favalli + + * src/gui/updatewindow.cpp, src/main.cpp, tmw.cbp: Removed home dir + from config file to avoid encoding issues. + 2007-08-26 Guillaume Melquiond * src/gui/button.cpp: Fixed incorrect button dimensions, as they mess @@ -58,10 +162,103 @@ for rectangle OpenGL textures when available, in order to reduce video memory usage. +2007-08-24 Bjørn Lindeijer + + * src/gui/gui.h, src/gui/gui.cpp: Removed useless logic method and + reverted mouse cursor to non-static since there can be only one Gui + instance so there is no point in supporting a shared resource. + * src/gui/window.cpp, src/gui/gui.h: Removed unnecessary + Gui::isCustomCursor method. + * src/gui/char_select.h, src/gui/char_select.cpp, src/utils/trim.h: + Added trimming of name for new character creation. + * src/net/chathandler.cpp: Added trimming of chat messages appearing + above players. + * src/gui/window.cpp, src/gui/window.h: Improved resize mouse cursor + indication, removing duplicated code and fixing indicator above resize + grip. + +2007-08-23 Bjørn Lindeijer + + * src/gui/viewport.h, src/gui/viewport.cpp: Removed two useless popup + related methods. + * src/gui/debugwindow.h, src/gui/debugwindow.cpp: Use generic close + button functionality. + * src/particle.h, src/particleemitter.cpp, src/particle.cpp: Renamed + Particle::mVector to Particle::mVelocity for clarity. + * src/localplayer.cpp, src/gui/ministatus.cpp, src/gui/status.cpp, + src/being.cpp, src/net/charserverhandler.cpp, + src/net/playerhandler.cpp, src/localplayer.h, src/being.h: Changed XP + gaining effect to appear on the player instead. + * data/graphics/gui/hits_yellow.png: Restored shadow of yellow font. + +2007-08-22 Bjørn Lindeijer + + * src/gui/itemshortcutcontainer.h: Fixed compiler warning. + * src/CMakeLists.txt, src/Makefile.am: Updated source lists. + * data/graphics/gui/CMakeLists.txt, data/graphics/gui/Makefile.am: + Added close button and item shortcut backgrounds to files that will be + installed. + * src/gui/itemshortcutcontainer.cpp: Make sure mGridWidth and + mGridHeight are initialized properly (fixes arithmetic exception in + ItemShortcutContainer::draw). + * src/keyboardconfig.cpp: Changed default sitting key back to 's'. + * src/net/equipmenthandler.cpp: Removed a line that attempted to set + the player's weapon sprite with each kind of equipment. Seems to work + fine without as well. + * src/gui/chat.cpp, src/utils/trim.h, src/CMakeLists.txt, + src/Makefile.am: Added trimming of chat messages. + +2007-08-22 Philipp Sehmisch + + * data/graphics/sprites/chest-lightplatemail-male.png, + data/graphics/sprites/chest-lightplatemail-female.png, + data/graphics/items/armor-chest-lightplatemail.png, + data/graphics/tiles/woodland_indoor_x2.png: Another color correction + at the light platemail (looks more metalic now) + * data/maps/new_18-1.tmx.gz, data/maps/new_19-1.tmx.gz, + data/images/minimap_new_18-1.png, data/images/minimap_new_19-1.png: + Removed a tree that prevented people from sitting on one of the + benches properly. Added correct minimap to woodland village and + surrounding. + +2007-08-22 Joshua Langley + + * data/graphics/gui/item_shortcut_bgr.png, src/game.cpp, + src/gui/gui.cpp, src/gui/itemcontainer.cpp, + src/gui/itemshortcutcontainer.cpp, src/gui/itemshortcutcontainer.h, + src/gui/itemshortcutwindow.cpp, src/gui/itemshortcutwindow.h, + src/gui/menuwindow.cpp, src/gui/setup_keyboard.cpp, src/gui/window.h, + src/itemshortcut.cpp, src/itemshortcut.h, src/keyboardconfig.cpp, + src/keyboardconfig.h, src/localplayer.cpp, src/localplayer.h, + src/main.cpp, src/net/inventoryhandler.cpp, src/utils/tostring.h, + tmw.cbp: Added item shortcut bar. + +2007-08-20 Joshua Langley + + * data/graphics/gui/mouse.png, src/gui/equipmentwindow.cpp, + src/gui/gui.cpp, src/gui/gui.h, src/gui/inventorywindow.cpp, + src/gui/setup.cpp, src/gui/skill.cpp, src/gui/skill.h, + src/gui/status.cpp, src/gui/window.cpp, src/gui/window.h, + data/graphics/gui/close_button.png: Added close button functionality, + resize cursor cues. + * data/graphics/gui/hits_yellow.png, src/being.cpp, src/being.h, + src/gui/gui.cpp, src/localplayer.cpp, src/localplayer.h, + src/net/charserverhandler.cpp, src/net/playerhandler.cpp, + src/particle.cpp, src/particle.h: Added monster killed xp notification + effect. + 2007-08-19 Bjørn Lindeijer - * src/CMakeLists.txt: Updated CMake file. * data/equipment.xml: Fixed typo in female light plate mail. + * NEWS: Updated with changes since 0.0.23. + * src/CMakeLists.txt: Updated CMake file. + +2007-08-19 Joshua Langley + + * src/keyboardconfig.cpp, src/keyboardconfig.h: Minor cleanup. + * src/gui/buy.cpp, src/gui/sell.cpp: Buy/sell fixed minimum quantity. + * src/gui/setup_keyboard.cpp, src/gui/setup_keyboard.h: Fixed bug - + reverts unassigned key. 2007-08-19 Guillaume Melquiond @@ -73,6 +270,23 @@ src/net/playerhandler.cpp, src/localplayer.h: Adapted to new server handling of character attributes. +2007-08-17 Bjørn Lindeijer + + * tools/adler32.c: Added little program for calculating adler32 + checksums of files. + * src/gui/setup_keyboard.cpp: Fixed compile issue related to array + bound not being an integer constant. + +2007-08-15 Philipp Sehmisch + + * data/graphics/sprites/npcs.png, data/graphics/sprites/npc.xml: + Added farmer NPC for woodland village. + +2007-08-14 Eugenio Favalli + + * src/gui/popupmenu.cpp, src/gui/viewport.cpp, src/gui/viewport.h, + tmw.cbp: Fixed popup menu requiring one more click after being used. + 2007-08-14 Guillaume Melquiond * src/net/messagein.h, src/net/messagein.cpp: Fixed error-prone @@ -111,6 +325,15 @@ * src/gui/npclistdialog.cpp, src/gui/npclistdialog.h, src/net/npchandler.cpp: Removed colon in NPC choice messages. +2007-08-09 Philipp Sehmisch + + * data/graphics/sprites/chest-lightplatemail-male.png, + data/graphics/sprites/chest-lightplatemail-female.png, + data/graphics/items/armor-chest-lightplatemail.png, + data/graphics/tiles/woodland_indoor_x2.png: Gave the platemail + armor a blue tint. Looks less boring and makes recoloring through + hue shifting possible. + 2007-08-09 Guillaume Melquiond * po/POTFILES.in: Updated list of translatable source files. @@ -133,9 +356,29 @@ data/graphics/images/EquipBackground.png: Re-designed equipment window, un-equip created. +2007-08-08 Philipp Sehmisch + + * data/graphics/particles/cookingfire.particle.xml, + data/graphics/particles/fireplace.particle.xml, + data/maps/new_20-1.tmx.gz: Added particle effects and music to the + woodland village indoor map. + * data/maps/new_19-1.tmx.gz: Added overlay effect and music to + woodland village outdoor map. + * data/maps/new_18-1.tmx.gz: Fixed some collision map errors and added + music and overlay effect to the surrounding of the woodland village. + +2007-08-07 Philipp Sehmisch + + * data/graphics/sprites/npcs.png: Added two new NPCs and gave some + of the older NPCs a makeover to look more like the style of the new + playerset. + * data/maps/new_20-1.tmx.gz: Corrected a few mapping errors in the + new woodland village. + * data/items.xml: Tweaked description and values of the scythe. + 2007-08-07 Guillaume Melquiond - * po/Makevars, src/main.cpp: Replaced PACKAGE by tmw to reduce + * po/Makevars, src/main.cpp: Replaced PACKAGE by tmw to reduce preprocessing hell. Set gettext charset to utf8. * src/gui/menuwindow.cpp, src/gui/connection.cpp, src/gui/register.cpp, src/gui/equipmentwindow.cpp, @@ -172,6 +415,14 @@ Makefile.am, autogen.sh: Used autopoint for generating gettext environment, and removed conflicting files. +2007-08-05 Philipp Sehmisch + + * data/graphics/tiles/woodland_indoor.png, + data/graphics/tiles/woodland_indoor_x2.png, + data/graphics/tiles/woodland_indoor_x3.png: Added woodland + village indoor tilesets. + * data/maps/new_20-1.tmx.gz: Added woodland village indoor map. + 2007-08-05 Guillaume Melquiond * configure.ac, Makefile.am, po, src/Makefile.am, src/main.cpp, @@ -222,12 +473,22 @@ src/gui/itemcontainer.cpp, src/gui/checkbox.cpp, src/gui/minimap.cpp, src/gui/scrollarea.cpp, src/gui/popupmenu.cpp: Removed useless yet costly dynamic casts. - -2007-07-25 Guillaume Melquiond - * src/net/beinghandler.cpp, src/net/protocol.h: Added being speed to protocol. +2007-07-25 Joshua Langley + + * src/gui/setup.cpp, src/gui/setup_keyboard.cpp, + src/gui/setup_keyboard.h, src/keyboardconfig.cpp, + src/keyboardconfig.h, src/main.cpp: Minor changes to keyboard config, + keyboard setup gui re-designed. + +2007-07-24 Bjørn Lindeijer + + * src/CMakeLists.txt, src/Makefile.am: Added setup_keyboard.* and + keyboardconfig.* to the list of source files. + * src/keyboardconfig.h: Fixed initialization order. + 2007-07-23 Eugenio Favalli * data/maps/new_1-1.tar.gz, data/maps/new_3-1.tar.gz: Fixed warp @@ -247,8 +508,21 @@ * data/maps/new_1-1.tar.gz: Fixed insecure filenames. +2007-07-17 Joshua Langley + + * src/game.cpp: Only one key per function. + * src/main.cpp: Keyboard configuration included. + * src/gui/button.cpp, src/gui/button.h: Default constructor and + init function added. + * src/gui/setup.cpp: Keyboard setup tab added. + * src/gui/setup_keyboard.cpp, src/gui/setup_keyboard.h: Add to project + file, it is the keyboard setup tab. + * src/keyboardconfig.cpp, src/keyboardconfig.h: Add to project file, + the main keyboard config operations. + 2007-07-16 Eugenio Favalli + * data/items.xml: Fixed description of silk headband. * data/maps/new_1-1.tar.gz, data/maps/new_3-1.tar.gz: Added warp and spawn areas. @@ -262,6 +536,24 @@ * src/net/beinghandler.cpp, src/net/beinghandler.h, src/net/protocol.h: Added support for visible equipment. +2007-07-11 Philipp Sehmisch + + * src/resources/monsterdb.cpp, src/resources/monsterinfo.cpp, + src/resources/monsterinfo.h, src/monster.cpp: Renamed SoundEvent + to MonsterSoundEvent. + * src/resources/equipmentdb.cpp, src/resources/equipmentinfo.cpp, + src/resources/equipmentinfo.h: EquipmentDB now holds the type of + attack animation and the sounds of weapons. + * src/being.cpp. src/being.h, src/localplayer.cpp, + src/net/beinghandler.cpp, src/net/charserverhandler.cpp, + src/net/equipmenthandler.cpp, src/player.cpp, src/player.h: The + type of weapon player characters are using is now set using + setVisibleEquipment() instead of setWeapon() or setWeaponById(). + * src/CMakeLists.txt, src/Makefile.AM, tmw.cbp, The Mana World.dev: + Updated project files and buildscripts. + * data/graphics/images/login-wallpaper.png: Replaced login wallpaper + with a new one by Irukard. + 2007-07-11 Bjørn Lindeijer * src/gui/window.cpp: Fixed resizing windows by their resize grip. diff --git a/data/graphics/gui/CMakeLists.txt b/data/graphics/gui/CMakeLists.txt index 5a02d7f1..649e0917 100644 --- a/data/graphics/gui/CMakeLists.txt +++ b/data/graphics/gui/CMakeLists.txt @@ -7,6 +7,7 @@ SET (FILES button.png buttonpress.png checkbox.png + close_button.png deepbox.png fixedfont.png hits_blue.png @@ -18,6 +19,8 @@ SET (FILES hscroll_right_default.png hscroll_right_highlight.png hscroll_right_pressed.png + item_shortcut_bgr.png + mouse.png menuitemD.png menuitemF.png menuitemN.png @@ -37,6 +40,7 @@ SET (FILES target-cursor-red-m.png target-cursor-red-s.png thickborder.png + unknown-item.png vscroll_blue.png vscroll_down_default.png vscroll_down_highlight.png diff --git a/data/graphics/gui/Makefile.am b/data/graphics/gui/Makefile.am index 92e4f3bb..7287d717 100644 --- a/data/graphics/gui/Makefile.am +++ b/data/graphics/gui/Makefile.am @@ -10,6 +10,7 @@ gui_DATA = \ buttonhi.png \ buttonpress.png \ checkbox.png \ + close_button.png \ deepbox.png \ equip_bg.png \ fixedfont.png \ @@ -22,6 +23,8 @@ gui_DATA = \ hscroll_right_default.png \ hscroll_right_highlight.png \ hscroll_right_pressed.png \ + item_shortcut_bgr.png \ + mouse.png \ menuitemD.png \ menuitemF.png \ menuitemN.png \ @@ -41,6 +44,7 @@ gui_DATA = \ target-cursor-red-m.png \ target-cursor-red-s.png \ thickborder.png \ + unknown-item.png \ vscroll_blue.png \ vscroll_down_default.png \ vscroll_down_highlight.png \ diff --git a/data/graphics/gui/close_button.png b/data/graphics/gui/close_button.png new file mode 100644 index 00000000..f87cc2a9 Binary files /dev/null and b/data/graphics/gui/close_button.png differ diff --git a/data/graphics/gui/hits_yellow.png b/data/graphics/gui/hits_yellow.png index f917bc67..d77b7c05 100644 Binary files a/data/graphics/gui/hits_yellow.png and b/data/graphics/gui/hits_yellow.png differ diff --git a/data/graphics/gui/item_shortcut_bgr.png b/data/graphics/gui/item_shortcut_bgr.png new file mode 100644 index 00000000..e878fc7a Binary files /dev/null and b/data/graphics/gui/item_shortcut_bgr.png differ diff --git a/data/graphics/gui/mouse.png b/data/graphics/gui/mouse.png index 2eeb0e51..84dc2ad1 100644 Binary files a/data/graphics/gui/mouse.png and b/data/graphics/gui/mouse.png differ diff --git a/data/graphics/gui/unknown-item.png b/data/graphics/gui/unknown-item.png new file mode 100644 index 00000000..9201d688 Binary files /dev/null and b/data/graphics/gui/unknown-item.png differ diff --git a/data/graphics/images/login_wallpaper.png b/data/graphics/images/login_wallpaper.png index 54692dfd..7af4f913 100644 Binary files a/data/graphics/images/login_wallpaper.png and b/data/graphics/images/login_wallpaper.png differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fa19cfb5..96338338 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -97,6 +97,12 @@ SET(SRCS gui/item_amount.h gui/itemcontainer.cpp gui/itemcontainer.h + gui/itemshortcutcontainer.cpp + gui/itemshortcutcontainer.h + gui/itemshortcutwindow.cpp + gui/itemshortcutwindow.h + gui/item_amount.cpp + gui/item_amount.h gui/linkhandler.h gui/listbox.cpp gui/listbox.h @@ -143,6 +149,8 @@ SET(SRCS gui/setup.h gui/setup_joystick.cpp gui/setup_joystick.h + gui/setup_keyboard.cpp + gui/setup_keyboard.h gui/setuptab.h gui/setup_video.cpp gui/setup_video.h @@ -170,12 +178,13 @@ SET(SRCS gui/updatewindow.h gui/vbox.cpp gui/vbox.h - gui/windowcontainer.cpp - gui/windowcontainer.h gui/viewport.cpp gui/viewport.h gui/window.cpp gui/window.h + gui/windowcontainer.cpp + gui/windowcontainer.h + gui/windowlistener.h gui/widgets/dropdown.cpp gui/widgets/dropdown.h net/beinghandler.cpp @@ -239,9 +248,6 @@ SET(SRCS resources/buddylist.h resources/animation.cpp resources/animation.h - resources/equipmentdb.cpp - resources/equipmentdb.h - resources/equipmentinfo.h resources/image.cpp resources/image.h resources/imagewriter.cpp @@ -281,6 +287,7 @@ SET(SRCS utils/strprintf.cpp utils/strprintf.h utils/tostring.h + utils/trim.h utils/xml.cpp utils/xml.h animatedsprite.cpp @@ -317,8 +324,12 @@ SET(SRCS inventory.h item.cpp item.h + itemshortcut.cpp + itemshortcut.h joystick.cpp joystick.h + keyboardconfig.cpp + keyboardconfig.h localplayer.cpp localplayer.h lockedarray.h @@ -351,6 +362,7 @@ SET(SRCS textparticle.cpp textparticle.h tileset.h + vector.h ) ADD_EXECUTABLE(tmw ${SRCS}) diff --git a/src/Makefile.am b/src/Makefile.am index 7006f66e..2f29e299 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -5,6 +5,8 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ gui/widgets/dropdown.h \ gui/widgets/resizegrip.cpp \ gui/widgets/resizegrip.h \ + gui/box.h \ + gui/box.cpp \ gui/browserbox.cpp \ gui/browserbox.h \ gui/buddywindow.cpp \ @@ -39,12 +41,20 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ gui/gccontainer.h \ gui/gui.cpp \ gui/gui.h \ + gui/hbox.h \ + gui/hbox.cpp \ gui/help.cpp \ gui/help.h \ + gui/inttextbox.h \ + gui/inttextbox.cpp \ gui/inventorywindow.cpp \ gui/inventorywindow.h \ gui/itemcontainer.cpp \ gui/itemcontainer.h \ + gui/itemshortcutcontainer.cpp \ + gui/itemshortcutcontainer.h \ + gui/itemshortcutwindow.cpp \ + gui/itemshortcutwindow.h \ gui/item_amount.cpp \ gui/item_amount.h \ gui/linkhandler.h \ @@ -95,6 +105,8 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ gui/setup.h \ gui/setup_joystick.cpp \ gui/setup_joystick.h \ + gui/setup_keyboard.cpp \ + gui/setup_keyboard.h \ gui/setuptab.h \ gui/setup_video.cpp \ gui/setup_video.h \ @@ -118,22 +130,17 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ gui/trade.h \ gui/unregisterdialog.cpp \ gui/unregisterdialog.h \ + gui/updatewindow.h \ + gui/updatewindow.cpp \ + gui/vbox.h \ + gui/vbox.cpp \ gui/viewport.cpp \ gui/viewport.h \ gui/window.cpp \ gui/window.h \ gui/windowcontainer.cpp \ gui/windowcontainer.h \ - gui/inttextbox.h \ - gui/inttextbox.cpp \ - gui/box.h \ - gui/box.cpp \ - gui/vbox.h \ - gui/vbox.cpp \ - gui/hbox.h \ - gui/hbox.cpp \ - gui/updatewindow.h \ - gui/updatewindow.cpp \ + gui/windowlistener.h \ net/beinghandler.h \ net/beinghandler.cpp \ net/buysellhandler.h \ @@ -193,9 +200,6 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ resources/ambientoverlay.h \ resources/animation.cpp \ resources/animation.h \ - resources/equipmentdb.cpp \ - resources/equipmentdb.h \ - resources/equipmentinfo.h \ resources/image.cpp \ resources/image.h \ resources/imageloader.cpp \ @@ -235,6 +239,7 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ utils/strprintf.h \ utils/strprintf.cpp \ utils/tostring.h \ + utils/trim.h \ utils/xml.cpp \ utils/xml.h \ animatedsprite.cpp \ @@ -271,8 +276,12 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ inventory.h \ item.cpp \ item.h \ + itemshortcut.cpp \ + itemshortcut.h \ joystick.cpp \ joystick.h \ + keyboardconfig.cpp \ + keyboardconfig.h \ localplayer.cpp \ localplayer.h \ lockedarray.h \ @@ -304,7 +313,8 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ sprite.h \ textparticle.cpp \ textparticle.h \ - tileset.h + tileset.h \ + vector.h # set the include path found by configure INCLUDES = \ diff --git a/src/animationparticle.cpp b/src/animationparticle.cpp index 30c33da7..c79a5bc4 100644 --- a/src/animationparticle.cpp +++ b/src/animationparticle.cpp @@ -26,7 +26,7 @@ #include "simpleanimation.h" AnimationParticle::AnimationParticle(Map *map, Animation *animation): - ImageParticle(map, 0), + ImageParticle(map, NULL), mAnimation(new SimpleAnimation(animation)) { } @@ -40,6 +40,7 @@ AnimationParticle::AnimationParticle(Map *map, xmlNodePtr animationNode): AnimationParticle::~AnimationParticle() { delete mAnimation; + mImage = NULL; } bool AnimationParticle::update() diff --git a/src/being.cpp b/src/being.cpp index bdb27384..81bed667 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -36,12 +36,10 @@ #include "resources/resourcemanager.h" #include "resources/imageset.h" +#include "resources/iteminfo.h" #include "gui/gui.h" -#include "resources/resourcemanager.h" -#include "resources/imageset.h" - #include "utils/dtor.h" #include "utils/tostring.h" @@ -58,11 +56,11 @@ Being::Being(Uint16 id, Uint16 job, Map *map): mEquipment(new Equipment()), mId(id), mSex(2), - mWeapon(0), mWalkSpeed(150), mSpeedModifier(1024), mSpriteDirection(DIRECTION_DOWN), mDirection(DOWN), mMap(NULL), + mEquippedWeapon(NULL), mHairStyle(0), mHairColor(0), mSpeechTime(0), mPx(0), mPy(0), @@ -302,7 +300,7 @@ Being::setSpeech(const std::string &text, Uint32 time) void Being::takeDamage(int amount) { - gcn::Font* font; + gcn::Font *font; std::string damage = amount ? toString(amount) : "miss"; // Selecting the right color @@ -312,8 +310,9 @@ Being::takeDamage(int amount) } else { - // hit particle effect - controlParticle(particleEngine->addEffect("graphics/particles/hit.particle.xml", 0, 0)); + // Hit particle effect + controlParticle(particleEngine->addEffect( + "graphics/particles/hit.particle.xml", 0, 0)); if (getType() == MONSTER) { @@ -325,7 +324,7 @@ Being::takeDamage(int amount) } } - // show damage number + // Show damage number particleEngine->addTextSplashEffect(damage, 255, 255, 255, font, mPx + 16, mPy + 16); } @@ -340,7 +339,7 @@ void Being::setMap(Map *map) { // Remove sprite from potential previous map - if (mMap != NULL) + if (mMap) { mMap->removeSprite(mSpriteIterator); } @@ -348,12 +347,12 @@ Being::setMap(Map *map) mMap = map; // Add sprite to potential new map - if (mMap != NULL) + if (mMap) { mSpriteIterator = mMap->addSprite(this); } - //clear particle effect list because child particles became invalid + // Clear particle effect list because child particles became invalid mChildParticleEffects.clear(); } @@ -362,7 +361,8 @@ Being::controlParticle(Particle *particle) { if (particle) { - particle->disableAutoDelete(); //the effect may not die without the beings permission or we segvault + // The effect may not die without the beings permission or we segfault + particle->disableAutoDelete(); mChildParticleEffects.push_back(particle); } } @@ -380,20 +380,12 @@ Being::setAction(Action action) currentAction = ACTION_SIT; break; case ATTACK: - switch (getWeapon()) + if (mEquippedWeapon) { - case 3: - currentAction = ACTION_ATTACK; - break; - case 2: - currentAction = ACTION_ATTACK_BOW; - break; - case 1: - currentAction = ACTION_ATTACK_STAB; - break; - case 0: - currentAction = ACTION_ATTACK; - break; + currentAction = mEquippedWeapon->getAttackType(); + } + else { + currentAction = ACTION_ATTACK; } for (int i = 0; i < VECTOREND_SPRITE; i++) { @@ -533,11 +525,9 @@ Being::logic() } } - //Update particle effects - for ( std::list::iterator i = mChildParticleEffects.begin(); - i != mChildParticleEffects.end(); - - ) + // Update particle effects + for (std::list::iterator i = mChildParticleEffects.begin(); + i != mChildParticleEffects.end();) { (*i)->setPosition((float)mPx + 16.0f, (float)mPy + 32.0f); if (!(*i)->isAlive()) @@ -599,46 +589,6 @@ Being::getType() const return UNKNOWN; } -void -Being::setWeaponById(Uint16 weapon) -{ - //TODO: Use an external file to map weapon IDs to weapon types - switch (weapon) - { - case 529: // iron arrows - case 1199: // arrows - break; - - case 623: //scythe - setWeapon(3); - break; - - case 1200: // bow - case 530: // short bow - case 545: // forest bow - setWeapon(2); - break; - - case 521: // sharp knife - /* UNCOMMENT TO TEST SHARP KNIFE AS SCYTHE - * setWeapon(3) - * break; - */ - case 522: // dagger - case 536: // short sword - case 1201: // knife - setWeapon(1); - break; - - case 0: // unequip - setWeapon(0); - break; - - default: - logger->log("Not a weapon: %d", weapon); - } -} - int Being::getOffset(int step) const { // Check whether we're walking in the requested direction diff --git a/src/being.h b/src/being.h index afb3cb8b..fadf9656 100644 --- a/src/being.h +++ b/src/being.h @@ -38,6 +38,7 @@ class AnimatedSprite; class Equipment; +class ItemInfo; class Item; class Map; class Graphics; @@ -161,8 +162,7 @@ class Being : public Sprite void setSpeech(const std::string &text, Uint32 time); /** - * Puts a damage bubble above this being for the specified amount of - * time. + * Puts a damage bubble above this being. * * @param amount The amount of damage. */ @@ -266,27 +266,6 @@ class Being : public Sprite */ virtual Type getType() const; - /** - * Gets the weapon picture id. - */ - Uint16 getWeapon() const { return mWeapon; } - - /** - * Sets the weapon picture id. - * - * @param weapon the picture id - */ - virtual void - setWeapon(Uint16 weapon) { mWeapon = weapon; } - - /** - * Sets the weapon picture id with the weapon id. - * - * @param weapon the weapon id - */ - void - setWeaponById(Uint16 weapon); - /** * Gets the walk speed. */ @@ -380,30 +359,26 @@ class Being : public Sprite getHeight() const; /** - * Returns the required size of a target cursor for this being + * Returns the required size of a target cursor for this being. */ - virtual Being::TargetCursorSize - getTargetCursorSize() const + virtual Being::TargetCursorSize getTargetCursorSize() const { return TC_MEDIUM; } std::auto_ptr mEquipment; /** - * Take control of a particle + * Take control of a particle. */ - void - controlParticle(Particle *particle); + void controlParticle(Particle *particle); protected: /** * Sets the new path for this being. */ - void - setPath(const Path &path, int mod = 1024); + void setPath(const Path &path, int mod = 1024); Uint16 mId; /**< Unique being id */ Uint8 mSex; /**< Character's gender */ - Uint16 mWeapon; /**< Weapon picture id */ Uint16 mWalkSpeed; /**< Walking speed */ Uint16 mSpeedModifier; /**< Modifier to keep course on sync (1024 = normal speed) */ Uint8 mSpriteDirection; /**< Facing direction */ @@ -411,6 +386,9 @@ class Being : public Sprite Map *mMap; /**< Map on which this being resides */ SpriteIterator mSpriteIterator; + /** Engine-related infos about weapon. */ + const ItemInfo* mEquippedWeapon; + Path mPath; std::string mSpeech; Uint16 mHairStyle, mHairColor; diff --git a/src/game.cpp b/src/game.cpp index 495f9a8d..a40bfa28 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -37,7 +37,9 @@ #include "engine.h" #include "flooritemmanager.h" #include "graphics.h" +#include "itemshortcut.h" #include "joystick.h" +#include "keyboardconfig.h" #include "localplayer.h" #include "log.h" #include "npc.h" @@ -53,6 +55,7 @@ #include "gui/gui.h" #include "gui/help.h" #include "gui/inventorywindow.h" +#include "gui/itemshortcutwindow.h" #include "gui/menuwindow.h" #include "gui/minimap.h" #include "gui/ministatus.h" @@ -116,6 +119,7 @@ TradeWindow *tradeWindow; //BuddyWindow *buddyWindow; HelpWindow *helpWindow; DebugWindow *debugWindow; +ItemShortcutWindow *itemShortcutWindow; BeingManager *beingManager = NULL; FloorItemManager *floorItemManager = NULL; @@ -181,6 +185,7 @@ void createGuiWindows() //buddyWindow = new BuddyWindow(); helpWindow = new HelpWindow(); debugWindow = new DebugWindow(); + itemShortcutWindow = new ItemShortcutWindow(); // Initialize window positions //chargeDialog->setPosition( @@ -193,6 +198,7 @@ void createGuiWindows() chatWindow->setVisible(true); miniStatusWindow->setVisible(true); menuWindow->setVisible(true); + itemShortcutWindow->setVisible(true); } /** @@ -220,6 +226,7 @@ void destroyGuiWindows() //delete buddyWindow; delete helpWindow; delete debugWindow; + delete itemShortcutWindow; } Game::Game(): @@ -420,6 +427,14 @@ void Game::handleInput() { gcn::Window *requestedWindow = NULL; + if (setupWindow->isVisible() && + keyboard.getNewKeyIndex() > keyboard.KEY_NO_VALUE) + { + keyboard.setNewKey((int) event.key.keysym.sym); + keyboard.callbackNewKey(); + keyboard.setNewKeyIndex(keyboard.KEY_NO_VALUE); + return; + } switch (event.key.keysym.sym) { case SDLK_F1: @@ -473,65 +488,7 @@ void Game::handleInput() used = true; } break; - - // Hide certain windows - case SDLK_h: - if (!chatWindow->isFocused()) - { - statusWindow->setVisible(false); - inventoryWindow->setVisible(false); - skillDialog->setVisible(false); - setupWindow->setVisible(false); - equipmentWindow->setVisible(false); - helpWindow->setVisible(false); - debugWindow->setVisible(false); - } - break; - - // Picking up items on the floor - case SDLK_g: - case SDLK_z: - if (!chatWindow->isFocused()) - { - Uint16 x = player_node->mX / 32, y = player_node->mY / 32; - FloorItem *item = floorItemManager->findByCoordinates(x, y); - - // If none below the player, try the tile in front of - // the player - if (!item) - { - // Temporary until tile-based picking is removed. - switch (player_node->getSpriteDirection()) - { - case DIRECTION_UP : --y; break; - case DIRECTION_DOWN : ++y; break; - case DIRECTION_LEFT : --x; break; - case DIRECTION_RIGHT: ++x; break; - default: break; - } - - item = floorItemManager->findByCoordinates(x, y); - } - - if (item) - player_node->pickUp(item); - - used = true; - } - break; - - // attacking - // TODO: Reimplement attacking with joystick buttons - // (old code allowed permanent attacking and not 1 attack - // with each button push) - // I would like to do this but i don't own a joystick. - case SDLK_LCTRL: - case SDLK_RCTRL: - player_node->attack(); - used = true; - break; - - // Quitting confirmation dialog + // Quitting confirmation dialog case SDLK_ESCAPE: if (!quitDialog) { @@ -547,6 +504,74 @@ void Game::handleInput() break; } + if (keyboard.isEnabled() && !chatWindow->isFocused()) + { + const int tKey = keyboard.getKeyIndex(event.key.keysym.sym); + // Checks if any item shortcut is pressed. + for (int i = KeyboardConfig::KEY_SHORTCUT_0; + i <= KeyboardConfig::KEY_SHORTCUT_9; + i++) + { + if (tKey == i) { + itemShortcut->useItem( + i - KeyboardConfig::KEY_SHORTCUT_0); + break; + } + } + switch (tKey) { + case KeyboardConfig::KEY_PICKUP: + { + Uint16 x = player_node->mX / 32; + Uint16 y = player_node->mY / 32; + FloorItem *item = + floorItemManager->findByCoordinates(x, y); + + // If none below the player, try the tile in front + // of the player + if (!item) + { + // Temporary until tile-based picking is + // removed. + switch (player_node->getSpriteDirection()) + { + case DIRECTION_UP : --y; break; + case DIRECTION_DOWN : ++y; break; + case DIRECTION_LEFT : --x; break; + case DIRECTION_RIGHT: ++x; break; + default: break; + } + + item = + floorItemManager->findByCoordinates(x, y); + } + + if (item) + player_node->pickUp(item); + + used = true; + } + break; + case KeyboardConfig::KEY_SIT: + // Player sit action + player_node->toggleSit(); + used = true; + break; + case KeyboardConfig::KEY_HIDE_WINDOWS: + // Hide certain windows + if (!chatWindow->isFocused()) + { + statusWindow->setVisible(false); + inventoryWindow->setVisible(false); + skillDialog->setVisible(false); + setupWindow->setVisible(false); + equipmentWindow->setVisible(false); + helpWindow->setVisible(false); + debugWindow->setVisible(false); + } + break; + } + } + if (requestedWindow) { requestedWindow->setVisible(!requestedWindow->isVisible()); @@ -563,19 +588,14 @@ void Game::handleInput() { switch (event.key.keysym.sym) { - case SDLK_s: - // Player sit action - player_node->toggleSit(); - used = true; - break; - case SDLK_p: // Screenshot (picture, hence the p) { SDL_Surface *screenshot = graphics->getScreenshot(); if (!saveScreenshot(screenshot)) { - logger->log("Error: could not save Screenshot."); + logger->log( + "Error: could not save Screenshot."); } SDL_FreeSurface(screenshot); } @@ -606,6 +626,8 @@ void Game::handleInput() case SDLK_8: emotion = 8; break; case SDLK_9: emotion = 9; break; case SDLK_0: emotion = 10; break; + case SDLK_MINUS: emotion = 11; break; + case SDLK_EQUALS: emotion = 12; break; default: emotion = 0; break; } @@ -638,41 +660,41 @@ void Game::handleInput() } } // End while - + // If the user is configuring the keys then don't respond. + if (!keyboard.isEnabled()) + { + return; + } // Moving player around if (player_node->mAction != Being::DEAD && current_npc == 0 && !chatWindow->isFocused()) { // Get the state of the keyboard keys - Uint8* keys; - keys = SDL_GetKeyState(NULL); + keyboard.refreshActiveKeys(); Uint16 x = player_node->mX / 32, y = player_node->mY / 32; unsigned char direction = 0; // Translate pressed keys to movement and direction - if (keys[SDLK_UP] || keys[SDLK_KP8] || - keys[SDLK_KP7] || keys[SDLK_KP9] || + if ( keyboard.isKeyActive(keyboard.KEY_MOVE_UP) || joystick && joystick->isUp()) { direction |= Being::UP; } - else if (keys[SDLK_DOWN] || keys[SDLK_KP2] || - keys[SDLK_KP1] || keys[SDLK_KP3] || + else if ( keyboard.isKeyActive(keyboard.KEY_MOVE_DOWN) || joystick && joystick->isDown()) { direction |= Being::DOWN; } - if (keys[SDLK_LEFT] || keys[SDLK_KP4] || - keys[SDLK_KP1] || keys[SDLK_KP7] || + + if ( keyboard.isKeyActive(keyboard.KEY_MOVE_LEFT) || joystick && joystick->isLeft()) { direction |= Being::LEFT; } - else if (keys[SDLK_RIGHT] || keys[SDLK_KP6] || - keys[SDLK_KP3] || keys[SDLK_KP9] || + else if ( keyboard.isKeyActive(keyboard.KEY_MOVE_RIGHT) || joystick && joystick->isRight()) { direction |= Being::RIGHT; @@ -681,7 +703,8 @@ void Game::handleInput() player_node->setWalkingDir(direction); // Target the nearest monster if 'a' pressed - if (keys[SDLK_a]) + if ( keyboard.isKeyActive(keyboard.KEY_TARGET_CLOSEST) ) + //if (keys[SDLK_a]) { Being *target = beingManager->findNearestLivingBeing(x, y, 20, Being::MONSTER); diff --git a/src/gui/button.cpp b/src/gui/button.cpp index 4e236c33..0379ebc0 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -60,10 +60,25 @@ static ButtonData const data[BUTTON_COUNT] = { ImageRect Button::button[BUTTON_COUNT]; +Button::Button(): + mIsLogged(false) +{ + init(); +} + Button::Button(const std::string& caption, const std::string &actionEventId, gcn::ActionListener *listener): gcn::Button(caption), mIsLogged(false) +{ + init(); + setActionEventId(actionEventId); + if (listener) { + addActionListener(listener); + } +} + +void Button::init() { setBorderSize(0); @@ -91,12 +106,7 @@ Button::Button(const std::string& caption, const std::string &actionEventId, btn[mode]->decRef(); } } - mInstances++; - setActionEventId(actionEventId); - if (listener) { - addActionListener(listener); - } } Button::~Button() diff --git a/src/gui/button.h b/src/gui/button.h index eb73e311..d12173b2 100644 --- a/src/gui/button.h +++ b/src/gui/button.h @@ -38,7 +38,13 @@ class ImageRect; class Button : public gcn::Button { public: /** - * Constructor, sets the caption of the button to the given string. + * Default constructor. + */ + Button(); + + /** + * Constructor, sets the caption of the button to the given string and + * adds the given action listener. */ Button(const std::string& caption, const std::string &actionEventId, gcn::ActionListener *listener); @@ -60,6 +66,8 @@ class Button : public gcn::Button { { mIsLogged = enable; } private: + void init(); + static ImageRect button[4]; /**< Button state graphics */ static int mInstances; /**< Number of button instances */ bool mIsLogged; /**< Makes the button appear pressed all the time */ diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 6cfe5e18..bbf2102e 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -28,6 +28,7 @@ #include "button.h" #include "scrollarea.h" #include "shop.h" +#include "shoplistbox.h" #include "slider.h" #include "../npc.h" @@ -35,11 +36,15 @@ #include "../resources/itemdb.h" #include "../utils/tostring.h" - BuyDialog::BuyDialog(): Window("Buy"), mMoney(0), mAmountItems(0), mMaxItems(0) { + setResizable(true); + setMinWidth(260); + setMinHeight(230); + setDefaultSize(0, 0, 260, 230); + mShopItems = new ShopItems; mShopItemList = new ShopListBox(mShopItems, mShopItems); @@ -54,32 +59,15 @@ BuyDialog::BuyDialog(): mItemDescLabel = new gcn::Label("Description:"); mItemEffectLabel = new gcn::Label("Effect:"); - setContentSize(260, 210); - mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - mScrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110)); - mShopItemList->setDimension(gcn::Rectangle(5, 5, 238, 110)); - - mSlider->setDimension(gcn::Rectangle(5, 120, 200, 10)); - mSlider->setEnabled(false); - - mQuantityLabel->setPosition(215, 120); - mMoneyLabel->setPosition(5, 130); - - mIncreaseButton->setPosition(40, 186); mIncreaseButton->setSize(20, 20); - mIncreaseButton->setEnabled(false); - - mDecreaseButton->setPosition(10, 186); mDecreaseButton->setSize(20, 20); - mDecreaseButton->setEnabled(false); + mQuantityLabel->setWidth(60); - mBuyButton->setPosition(180, 186); + mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mIncreaseButton->setEnabled(false); + mDecreaseButton->setEnabled(false); mBuyButton->setEnabled(false); - - mQuitButton->setPosition(212, 186); - - mItemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14)); - mItemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14)); + mSlider->setEnabled(false); mShopItemList->setActionEventId("item"); mSlider->setActionEventId("slider"); @@ -98,6 +86,8 @@ BuyDialog::BuyDialog(): add(mItemDescLabel); add(mItemEffectLabel); + addWindowListener(this); + loadWindowState("Buy"); setLocationRelativeTo(getParent()); } @@ -118,13 +108,12 @@ void BuyDialog::reset() { mShopItems->clear(); mShopItemList->adjustSize(); - mMoney = 0; - mSlider->setValue(0.0); - // Reset Previous Selected Items to prevent failing asserts + // Reset previous selected items to prevent failing asserts mShopItemList->setSelected(-1); + mSlider->setValue(0); - updateButtonsAndLabels(); + setMoney(0); } void BuyDialog::addItem(int id, int amount, int price) @@ -141,6 +130,7 @@ void BuyDialog::action(const gcn::ActionEvent &event) { setVisible(false); current_npc = 0; + return; } // The following actions require a valid selection @@ -152,21 +142,19 @@ void BuyDialog::action(const gcn::ActionEvent &event) if (event.getId() == "slider") { - mAmountItems = (int)(mSlider->getValue() * mMaxItems); + mAmountItems = (int) mSlider->getValue(); updateButtonsAndLabels(); } else if (event.getId() == "+" && mAmountItems < mMaxItems) { mAmountItems++; - - mSlider->setValue((double) mAmountItems / (double) mMaxItems); + mSlider->setValue(mAmountItems); updateButtonsAndLabels(); } - else if (event.getId() == "-" && mAmountItems > 0) + else if (event.getId() == "-" && mAmountItems > 1) { mAmountItems--; - - mSlider->setValue((double) mAmountItems / (double) mMaxItems); + mSlider->setValue(mAmountItems); updateButtonsAndLabels(); } // TODO: Actually we'd have a bug elsewhere if this check for the number @@ -178,25 +166,69 @@ void BuyDialog::action(const gcn::ActionEvent &event) Net::GameServer::Player::tradeWithNPC (mShopItems->at(selectedItem).id, mAmountItems); - // Update money and adjust the max number of items that can be bought - mMoney -= mAmountItems * mShopItems->at(selectedItem).price; - mMaxItems -= mAmountItems; - // Reset selection - mAmountItems = 0; - mSlider->setValue(0.0); + mAmountItems = 1; + mSlider->setValue(1); + mSlider->gcn::Slider::setScale(1, mMaxItems); - updateButtonsAndLabels(); + // Update money and adjust the max number of items that can be bought + mMaxItems -= mAmountItems; + setMoney(mMoney - mAmountItems * mShopItems->at(selectedItem).price); } } void BuyDialog::selectionChanged(const SelectionEvent &event) { + // Reset amount of items and update labels - mAmountItems = 0; - mSlider->setValue(0.0); + mAmountItems = 1; + mSlider->setValue(1); updateButtonsAndLabels(); + mSlider->gcn::Slider::setScale(1, mMaxItems); +} + +void BuyDialog::windowResized(const WindowEvent &event) +{ + gcn::Rectangle area = getChildrenArea(); + int width = area.width; + int height = area.height; + + mDecreaseButton->setPosition(8, height - 8 - mDecreaseButton->getHeight()); + mIncreaseButton->setPosition( + mDecreaseButton->getX() + mDecreaseButton->getWidth() + 5, + mDecreaseButton->getY()); + + mQuitButton->setPosition( + width - 8 - mQuitButton->getWidth(), + height - 8 - mQuitButton->getHeight()); + mBuyButton->setPosition( + mQuitButton->getX() - 5 - mBuyButton->getWidth(), + mQuitButton->getY()); + + mItemDescLabel->setDimension(gcn::Rectangle(8, + mBuyButton->getY() - 5 - mItemDescLabel->getHeight(), + width - 16, + mItemDescLabel->getHeight())); + mItemEffectLabel->setDimension(gcn::Rectangle(8, + mItemDescLabel->getY() - 5 - mItemEffectLabel->getHeight(), + width - 16, + mItemEffectLabel->getHeight())); + mMoneyLabel->setDimension(gcn::Rectangle(8, + mItemEffectLabel->getY() - 5 - mMoneyLabel->getHeight(), + width - 16, + mMoneyLabel->getHeight())); + + mQuantityLabel->setPosition( + width - mQuantityLabel->getWidth() - 8, + mMoneyLabel->getY() - 5 - mQuantityLabel->getHeight()); + mSlider->setDimension(gcn::Rectangle(8, + mQuantityLabel->getY(), + mQuantityLabel->getX() - 8 - 8, + 10)); + + mScrollArea->setDimension(gcn::Rectangle(8, 8, width - 16, + mSlider->getY() - 5 - 8)); } void @@ -232,14 +264,13 @@ BuyDialog::updateButtonsAndLabels() // Enable or disable buttons and slider mIncreaseButton->setEnabled(mAmountItems < mMaxItems); - mDecreaseButton->setEnabled(mAmountItems > 0); + mDecreaseButton->setEnabled(mAmountItems > 1); mBuyButton->setEnabled(mAmountItems > 0); - mSlider->setEnabled(mMaxItems > 0); + mSlider->setEnabled(mMaxItems > 1); // Update quantity and money labels - mQuantityLabel->setCaption(toString(mAmountItems)); - mQuantityLabel->adjustSize(); + mQuantityLabel->setCaption( + toString(mAmountItems) + " / " + toString(mMaxItems)); mMoneyLabel->setCaption("Price: " + toString(price) + " GP / " + toString(mMoney - price) + " GP" ); - mMoneyLabel->adjustSize(); } diff --git a/src/gui/buy.h b/src/gui/buy.h index 875deef9..63d25583 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -28,11 +28,11 @@ #include "window.h" #include "selectionlistener.h" -#include "shoplistbox.h" #include "../guichanfwd.h" class ShopItems; +class ShopListBox; class ListBox; /** @@ -40,7 +40,8 @@ class ListBox; * * \ingroup Interface */ -class BuyDialog : public Window, public gcn::ActionListener, SelectionListener +class BuyDialog : public Window, public gcn::ActionListener, SelectionListener, + WindowListener { public: /** @@ -98,6 +99,11 @@ class BuyDialog : public Window, public gcn::ActionListener, SelectionListener void updateButtonsAndLabels(); + /** + * Called whenever the window is resized. + */ + void windowResized(const WindowEvent &event); + private: gcn::Button *mBuyButton; gcn::Button *mQuitButton; diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index d752cdb3..e8381bef 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -48,6 +48,7 @@ #include "../utils/gettext.h" #include "../utils/strprintf.h" #include "../utils/tostring.h" +#include "../utils/trim.h" // Defined in main.cpp, used here for setting the char create dialog extern CharServerHandler charServerHandler; @@ -255,11 +256,6 @@ bool CharSelectDialog::selectByName(const std::string &name) return false; } -std::string CharSelectDialog::getName() -{ - return mNameLabel->getCaption(); -} - CharCreateDialog::CharCreateDialog(Window *parent, int slot): Window(_("Create Character"), true, parent), mSlot(slot) { @@ -410,10 +406,12 @@ CharCreateDialog::action(const gcn::ActionEvent &event) } } -const std::string& +std::string CharCreateDialog::getName() { - return mNameField->getText(); + std::string name = mNameField->getText(); + trim(name); + return name; } void CharCreateDialog::UpdateSliders() diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 9d9184ea..5d0b42fa 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.h @@ -60,11 +60,6 @@ class CharSelectDialog : public Window, public gcn::ActionListener bool selectByName(const std::string &name); - /** - * Returns name of selected player - */ - std::string getName(); - private: LockedArray *mCharInfo; @@ -114,22 +109,28 @@ class CharCreateDialog : public Window, public gcn::ActionListener */ ~CharCreateDialog(); - void - action(const gcn::ActionEvent &event); - - const std::string& - getName(); + void action(const gcn::ActionEvent &event); /** * Unlocks the dialog, enabling the create character button again. */ - void - unlock(); + void unlock(); private: int getDistributedPoints(); + void UpdateSliders(); + /** + * Returns the name of the character to create. + */ + std::string getName(); + + /** + * Communicate character creation to the server. + */ + void attemptCharCreate(); + gcn::TextField *mNameField; gcn::Label *mNameLabel; gcn::Button *mNextHairColorButton; @@ -154,12 +155,6 @@ class CharCreateDialog : public Window, public gcn::ActionListener static const int mMaxPoints = 70; int mUsedPoints; - - - /** - * Communicate character creation to the server. - */ - void attemptCharCreate(); }; #endif diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index ba7c7f02..4ed8bb97 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -44,6 +44,7 @@ #include "../net/gameserver/player.h" #include "../utils/dtor.h" +#include "../utils/trim.h" ChatWindow::ChatWindow(): Window(), @@ -125,7 +126,7 @@ void ChatWindow::chatLog(std::string line, int own, std::string channelName) { // Delete overhead from the end of the list - while ((int)mChatlog.size() > mItemsKeep) { + while ((int) mChatlog.size() > mItemsKeep) { mChatlog.pop_back(); } @@ -142,12 +143,15 @@ ChatWindow::chatLog(std::string line, int own, std::string channelName) own = BY_SERVER; } - int pos = line.find(" : "); - if (pos > 0) { + std::string::size_type pos = line.find(" : "); + if (pos != std::string::npos) { tmp.nick = line.substr(0, pos); line.erase(0, pos + 3); } + // Trim whitespace + trim(line); + std::string lineColor = "##0"; // Equiv. to BrowserBox::BLACK switch (own) { case BY_GM: diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 11ad37c2..884cdf7e 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -42,6 +42,7 @@ DebugWindow::DebugWindow(): Window("Debug") { setResizable(true); + setCloseButton(true); setDefaultSize(0, 0, 400, 100); loadWindowState("Debug"); @@ -60,15 +61,11 @@ DebugWindow::DebugWindow(): mParticleCountLabel = new gcn::Label("[Particle count: 0]"); mParticleCountLabel->setPosition(100, 60); - Button *closeButton = new Button("Close", "close", this); - closeButton->setPosition(5, 60); - add(mFPSLabel); add(mMusicFileLabel); add(mMapFileLabel); add(mTileMouseLabel); add(mParticleCountLabel); - add(closeButton); } void @@ -106,12 +103,3 @@ DebugWindow::logic() +"]"); mParticleCountLabel->adjustSize(); } - -void -DebugWindow::action(const gcn::ActionEvent &event) -{ - if (event.getId() == "close") - { - setVisible(false); - } -} diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index d082b2ca..9b6f2017 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.h @@ -33,11 +33,11 @@ #include "../guichanfwd.h" /** - * The chat window. + * The debug window. * * \ingroup Interface */ -class DebugWindow : public Window, public gcn::ActionListener +class DebugWindow : public Window { public: /** @@ -50,11 +50,6 @@ class DebugWindow : public Window, public gcn::ActionListener */ void logic(); - /** - * Performs action. - */ - void action(const gcn::ActionEvent &event); - private: gcn::Label *mMusicFileLabel, *mMapFileLabel; gcn::Label *mTileMouseLabel, *mFPSLabel; diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 5e835985..c86a27fc 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -59,6 +59,7 @@ EquipmentWindow::EquipmentWindow(Equipment *equipment): mBackground(NULL), mSelected(-1) { + setCloseButton(true); setDefaultSize(5, 195, 216, 260); loadWindowState("Equipment"); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index dc51054c..97dd4d44 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -42,7 +42,7 @@ #include "../graphics.h" #include "../log.h" -#include "../resources/image.h" +#include "../resources/imageset.h" #include "../resources/resourcemanager.h" #include "../resources/imageloader.h" @@ -77,8 +77,9 @@ class GuiConfigListener : public ConfigListener }; Gui::Gui(Graphics *graphics): - mMouseCursor(NULL), - mCustomCursor(false) + mCustomCursor(false), + mMouseCursors(NULL), + mCursorType(CURSOR_POINTER) { logger->log("Initializing GUI..."); // Set graphics @@ -106,7 +107,7 @@ Gui::Gui(Graphics *graphics): // Set global font try { - mGuiFont = new TrueTypeFont("data/fonts/dejavusans.ttf", 12); + mGuiFont = new TrueTypeFont("data/fonts/dejavusans.ttf", 11); } catch (gcn::Exception e) { @@ -139,7 +140,7 @@ Gui::Gui(Graphics *graphics): hitBlueFont = new gcn::ImageFont("graphics/gui/hits_blue.png", "0123456789"); hitYellowFont = new gcn::ImageFont("graphics/gui/hits_yellow.png", - "mis"); + "0123456789misxp "); } catch (gcn::Exception e) { @@ -169,8 +170,8 @@ Gui::~Gui() delete hitBlueFont; delete hitYellowFont; - if (mMouseCursor) { - mMouseCursor->decRef(); + if (mMouseCursors) { + mMouseCursors->decRef(); } delete mGuiFont; @@ -181,12 +182,6 @@ Gui::~Gui() delete guiInput; } -void -Gui::logic() -{ - gcn::Gui::logic(); -} - void Gui::draw() { @@ -196,11 +191,13 @@ Gui::draw() int mouseX, mouseY; Uint8 button = SDL_GetMouseState(&mouseX, &mouseY); - if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1)) - && mCustomCursor) + if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1)) && + mCustomCursor) { - static_cast(mGraphics)-> - drawImage(mMouseCursor, mouseX - 5, mouseY - 2); + static_cast(mGraphics)->drawImage( + mMouseCursors->get(mCursorType), + mouseX - 15, + mouseY - 17); } mGraphics->popClipArea(); @@ -220,9 +217,11 @@ Gui::setUseCustomCursor(bool customCursor) // Load the mouse cursor ResourceManager *resman = ResourceManager::getInstance(); - mMouseCursor = resman->getImage("graphics/gui/mouse.png"); - if (!mMouseCursor) { - logger->error("Unable to load mouse cursor."); + mMouseCursors = + resman->getImageSet("graphics/gui/mouse.png", 40, 40); + + if (!mMouseCursors) { + logger->error("Unable to load mouse cursors."); } } else @@ -231,9 +230,9 @@ Gui::setUseCustomCursor(bool customCursor) SDL_ShowCursor(SDL_ENABLE); // Unload the mouse cursor - if (mMouseCursor) { - mMouseCursor->decRef(); - mMouseCursor = NULL; + if (mMouseCursors) { + mMouseCursors->decRef(); + mMouseCursors = NULL; } } } diff --git a/src/gui/gui.h b/src/gui/gui.h index 5f2cc810..1e4b9348 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -30,7 +30,7 @@ class GuiConfigListener; class Graphics; -class Image; +class ImageSet; class Viewport; /** @@ -59,36 +59,49 @@ class Gui : public gcn::Gui */ ~Gui(); - /** - * Works around Guichan bug - */ - void - logic(); - /** * Draws the whole Gui by calling draw functions down in the * Gui hierarchy. It also draws the mouse pointer. */ - void - draw(); + void draw(); /** - * Return game font + * Return game font. */ - gcn::Font* - getFont() { return mGuiFont; } + gcn::Font* getFont() const + { return mGuiFont; } /** * Sets whether a custom cursor should be rendered. */ - void - setUseCustomCursor(bool customCursor); + void setUseCustomCursor(bool customCursor); + + /** + * Sets which cursor should be used. + */ + void setCursorType(int index) + { mCursorType = index; } + + /** + * Cursors are in graphic order from left to right. + * CURSOR_POINTER should be left untouched. + * CURSOR_TOTAL should always be last. + */ + enum { + CURSOR_POINTER = 0, + CURSOR_RESIZE_ACROSS, + CURSOR_RESIZE_DOWN, + CURSOR_RESIZE_DOWN_LEFT, + CURSOR_RESIZE_DOWN_RIGHT, + CURSOR_TOTAL + }; private: GuiConfigListener *mConfigListener; gcn::Font *mGuiFont; /**< The global GUI font */ - Image *mMouseCursor; /**< Mouse cursor image */ bool mCustomCursor; /**< Show custom cursor */ + ImageSet *mMouseCursors; /**< Mouse cursor images */ + int mCursorType; }; extern Gui *gui; /**< The GUI system */ diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 085ab188..1e62b130 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -51,6 +51,7 @@ InventoryWindow::InventoryWindow(): mSplit(false) { setResizable(true); + setCloseButton(true); setMinWidth(240); setMinHeight(172); // If you adjust these defaults, don't forget to adjust the trade window's. @@ -69,7 +70,6 @@ InventoryWindow::InventoryWindow(): mItems->addSelectionListener(this); mInvenScroll = new ScrollArea(mItems); - mInvenScroll->setPosition(8, 8); mItemNameLabel = new gcn::Label(strprintf(_("Name: %s"), "")); mItemDescriptionLabel = new gcn::Label( @@ -100,8 +100,8 @@ InventoryWindow::InventoryWindow(): mSplitButton->setWidth(48); } + addWindowListener(this); loadWindowState("Inventory"); - updateContentSize(); } InventoryWindow::~InventoryWindow() @@ -130,7 +130,6 @@ void InventoryWindow::logic() mWeightLabel->setCaption( strprintf(_("Total Weight: %d - Maximum Weight: %d"), player_node->getTotalWeight(), player_node->getMaxWeight())); - mWeightLabel->adjustSize(); } void InventoryWindow::action(const gcn::ActionEvent &event) @@ -215,7 +214,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event) } } -void InventoryWindow::updateContentSize() +void InventoryWindow::windowResized(const WindowEvent &event) { const gcn::Rectangle area = getChildrenArea(); @@ -260,8 +259,7 @@ Item* InventoryWindow::getItem() return mItems->getItem(); } -void -InventoryWindow::keyPressed(gcn::KeyEvent &event) +void InventoryWindow::keyPressed(gcn::KeyEvent &event) { switch (event.getKey().getValue()) { @@ -271,8 +269,7 @@ InventoryWindow::keyPressed(gcn::KeyEvent &event) } } -void -InventoryWindow::keyReleased(gcn::KeyEvent &event) +void InventoryWindow::keyReleased(gcn::KeyEvent &event) { switch (event.getKey().getValue()) { diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 37ef0406..a9fdadf2 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -29,8 +29,9 @@ #include -#include "window.h" #include "selectionlistener.h" +#include "window.h" +#include "windowlistener.h" #include "../guichanfwd.h" @@ -45,7 +46,8 @@ class ItemContainer; class InventoryWindow : public Window, public gcn::ActionListener, public gcn::KeyListener, - public SelectionListener + public SelectionListener, + public WindowListener { public: /** @@ -92,7 +94,10 @@ class InventoryWindow : public Window, */ void selectionChanged(const SelectionEvent &event); - void updateContentSize(); /**< Updates widgets size/position. */ + /** + * Called whenever the window is resized. + */ + void windowResized(const WindowEvent &event); private: void updateButtons(); /**< Updates button states. */ diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index b032bd49..bddf7cee 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -30,6 +30,7 @@ #include "../graphics.h" #include "../inventory.h" #include "../item.h" +#include "../itemshortcut.h" #include "../localplayer.h" #include "../resources/image.h" @@ -38,6 +39,9 @@ #include "../utils/tostring.h" +// TODO: Add support for adding items to the item shortcut window (global +// itemShortcut). + static const int BOX_WIDTH = 36; static const int BOX_HEIGHT = 44; diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp new file mode 100644 index 00000000..1943ef93 --- /dev/null +++ b/src/gui/itemshortcutcontainer.cpp @@ -0,0 +1,224 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "itemshortcutcontainer.h" + +#include "../graphics.h" +#include "../item.h" +#include "../itemshortcut.h" +#include "../keyboardconfig.h" + +#include "../resources/image.h" +#include "../resources/resourcemanager.h" + +#include "../utils/tostring.h" + +ItemShortcutContainer::ItemShortcutContainer(): + mGridWidth(1), + mGridHeight(1), + mItemClicked(false), + mItemMoved(NULL) +{ + addMouseListener(this); + + ResourceManager *resman = ResourceManager::getInstance(); + + mBackgroundImg = resman->getImage("graphics/gui/item_shortcut_bgr.png"); + mMaxItems = itemShortcut->getItemCount(); + + mBoxHeight = 42; + mBoxWidth = 36; +} + +ItemShortcutContainer::~ItemShortcutContainer() +{ + mBackgroundImg->decRef(); +} + +void +ItemShortcutContainer::logic() +{ + gcn::Widget::logic(); + + int i = itemShortcut->getItemCount(); + + if (i != mMaxItems) + { + mMaxItems = i; + setWidth(getWidth()); + } +} + +void +ItemShortcutContainer::draw(gcn::Graphics *graphics) +{ + Graphics *g = static_cast(graphics); + + for (int i = 0; i < mMaxItems; i++) + { + const int itemX = (i % mGridWidth) * mBoxWidth; + const int itemY = (i / mGridWidth) * mBoxHeight; + + g->drawImage(mBackgroundImg, itemX, itemY); + + // Draw item keyboard shortcut. + const char *key = SDL_GetKeyName( + (SDLKey) keyboard.getKeyValue(keyboard.KEY_SHORTCUT_0+i)); + g->drawText(key, itemX + 2, itemY + 2, gcn::Graphics::LEFT); + + Item *item = itemShortcut->getItem(i); + if (item) { + // Draw item icon. + Image* image = item->getInfo().getImage(); + if (image) { + g->drawImage(image, itemX, itemY); + g->drawText( + toString(item->getQuantity()), + itemX + mBoxWidth / 2, + itemY + mBoxHeight - 14, + gcn::Graphics::CENTER); + } + } + } + if (mItemMoved) + { + // Draw the item image being dragged by the cursor. + Image* image = mItemMoved->getInfo().getImage(); + if (image) + { + const int tPosX = mCursorPosX - (image->getWidth() / 2); + const int tPosY = mCursorPosY - (image->getHeight() / 2); + + g->drawImage(image, tPosX, tPosY); + g->drawText( + toString(mItemMoved->getQuantity()), + tPosX + mBoxWidth / 2, + tPosY + mBoxHeight - 14, + gcn::Graphics::CENTER); + } + } +} + +void +ItemShortcutContainer::setWidth(int width) +{ + gcn::Widget::setWidth(width); + + mGridWidth = getWidth() / mBoxWidth; + if (mGridWidth < 1) { + mGridWidth = 1; + } + + setHeight((mMaxItems / mGridWidth + + (mMaxItems % mGridWidth > 0 ? 1 : 0)) * mBoxHeight); + + mGridHeight = getHeight() / mBoxHeight; + if (mGridHeight < 1) { + mGridHeight = 1; + } +} + +void +ItemShortcutContainer::mouseDragged(gcn::MouseEvent &event) +{ + if (event.getButton() == gcn::MouseEvent::LEFT) { + if (!mItemMoved && mItemClicked) { + const int index = getIndexFromGrid(event.getX(), event.getY()); + if (index == -1) { + return; + } + Item *item = itemShortcut->getItem(index); + if (item) + { + mItemMoved = item; + itemShortcut->removeItem(index); + } + } + if (mItemMoved) { + mCursorPosX = event.getX(); + mCursorPosY = event.getY(); + } + } +} + +void +ItemShortcutContainer::mousePressed(gcn::MouseEvent &event) +{ + const int index = getIndexFromGrid(event.getX(), event.getY()); + if (index == -1) { + return; + } + + // Stores the selected item if theirs one. + if (itemShortcut->isItemSelected()) { + itemShortcut->setItem(index); + itemShortcut->setItemSelected(NULL); + } + else if (itemShortcut->getItem(index)) { + mItemClicked = true; + } +} + +void +ItemShortcutContainer::mouseReleased(gcn::MouseEvent &event) +{ + if (event.getButton() == gcn::MouseEvent::LEFT) + { + if (itemShortcut->isItemSelected()) + { + itemShortcut->setItemSelected(NULL); + } + const int index = getIndexFromGrid(event.getX(), event.getY()); + if (index == -1) { + mItemMoved = NULL; + return; + } + if (mItemMoved) { + itemShortcut->setItems(index, mItemMoved); + mItemMoved = NULL; + } + else if (itemShortcut->getItem(index) && mItemClicked) + { + itemShortcut->useItem(index); + } + if (mItemClicked) { + mItemClicked = false; + } + } +} + +int +ItemShortcutContainer::getIndexFromGrid(int pointX, int pointY) const +{ + const gcn::Rectangle tRect = gcn::Rectangle( + 0, 0, mGridWidth * mBoxWidth, mGridHeight * mBoxHeight); + if (!tRect.isPointInRect(pointX, pointY)) { + return -1; + } + const int index = ((pointY / mBoxHeight) * mGridWidth) + + pointX / mBoxWidth; + if (index >= mMaxItems) + { + return -1; + } + return index; +} diff --git a/src/gui/itemshortcutcontainer.h b/src/gui/itemshortcutcontainer.h new file mode 100644 index 00000000..4b154cbb --- /dev/null +++ b/src/gui/itemshortcutcontainer.h @@ -0,0 +1,115 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef _TMW_ITEMSHORTCUTCONTAINER_H__ +#define _TMW_ITEMSHORTCUTCONTAINER_H__ + +#include +#include + +#include + +class Image; +class Item; + +/** + * An item shortcut container. Used to quickly use items. + * + * \ingroup GUI + */ +class ItemShortcutContainer : public gcn::Widget, public gcn::MouseListener +{ + public: + /** + * Constructor. Initializes the graphic. + */ + ItemShortcutContainer(); + + /** + * Destructor. + */ + virtual ~ItemShortcutContainer(); + + /** + * Handles the logic of the ItemContainer + */ + void logic(); + + /** + * Draws the items. + */ + void draw(gcn::Graphics *graphics); + + /** + * Sets the width of the container. This is used to determine the new + * height of the container. + */ + void setWidth(int width); + + /** + * Handles mouse when dragged. + */ + void mouseDragged(gcn::MouseEvent &event); + + /** + * Handles mouse when pressed. + */ + void mousePressed(gcn::MouseEvent &event); + + /** + * Handles mouse release. + */ + void mouseReleased(gcn::MouseEvent &event); + + + int getMaxItems() + { return mMaxItems; } + + int getBoxWidth() + { return mBoxWidth; } + + int getBoxHeight() + { return mBoxHeight; } + + private: + /** + * Gets the index from the grid provided the point is in an item box. + * + * @param pointX X coordinate of the point. + * @param pointY Y coordinate of the point. + * @return index on success, -1 on failure. + */ + int getIndexFromGrid(int pointX, int pointY) const; + + Image *mBackgroundImg; + + int mMaxItems; + int mBoxWidth; + int mBoxHeight; + int mCursorPosX, mCursorPosY; + int mGridWidth, mGridHeight; + bool mItemClicked; + Item *mItemMoved; + +}; + +#endif diff --git a/src/gui/itemshortcutwindow.cpp b/src/gui/itemshortcutwindow.cpp new file mode 100644 index 00000000..dd97a7db --- /dev/null +++ b/src/gui/itemshortcutwindow.cpp @@ -0,0 +1,74 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "itemshortcutwindow.h" + +#include "itemshortcutcontainer.h" +#include "scrollarea.h" + +static const int SCROLL_PADDING = 0; + +ItemShortcutWindow::ItemShortcutWindow() +{ + // no title presented, title bar is padding so window can be moved. + gcn::Window::setTitleBarHeight(gcn::Window::getPadding()); + setShowTitle(false); + setResizable(true); + setDefaultSize(758, 174, 42, 426); + + mItems = new ItemShortcutContainer(); + + int border = SCROLL_PADDING * 2 + getPadding() * 2; + setMinWidth(mItems->getBoxWidth() + border); + setMinHeight(mItems->getBoxHeight() + border); + setMaxWidth(mItems->getBoxWidth() * mItems->getMaxItems() + border); + setMaxHeight(mItems->getBoxHeight() * mItems->getMaxItems() + border); + + mInvenScroll = new ScrollArea(mItems); + mInvenScroll->setPosition(SCROLL_PADDING, SCROLL_PADDING); + mInvenScroll->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + + add(mInvenScroll); + + addWindowListener(this); + loadWindowState("ItemShortcut"); +} + +ItemShortcutWindow::~ItemShortcutWindow() +{ + delete mItems; + delete mInvenScroll; +} + +void ItemShortcutWindow::logic() +{ + Window::logic(); +} + +void ItemShortcutWindow::windowResized(const WindowEvent &event) +{ + const gcn::Rectangle area = getChildrenArea(); + + mInvenScroll->setSize( + area.width - SCROLL_PADDING, + area.height - SCROLL_PADDING); +} diff --git a/src/gui/itemshortcutwindow.h b/src/gui/itemshortcutwindow.h new file mode 100644 index 00000000..83bc348d --- /dev/null +++ b/src/gui/itemshortcutwindow.h @@ -0,0 +1,69 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef _TMW_ITEMSHORTCUTWINDOW_H +#define _TMW_ITEMSHORTCUTWINDOW_H + +#include "window.h" +#include "windowlistener.h" + +#include "../guichanfwd.h" + +class ItemShortcutContainer; + +/** + * Inventory dialog. + * + * \ingroup Interface + */ +class ItemShortcutWindow : public Window, WindowListener +{ + public: + /** + * Constructor. + */ + ItemShortcutWindow(); + + /** + * Destructor. + */ + ~ItemShortcutWindow(); + + /** + * Logic (updates buttons and weight information). + */ + void logic(); + + /** + * Called whenever the window is resized. + */ + void windowResized(const WindowEvent &event); + + private: + ItemShortcutContainer *mItems; + + gcn::ScrollArea *mInvenScroll; +}; + +extern ItemShortcutWindow *itemShortcutWindow; + +#endif diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp index bfa2f1f2..8d4d184d 100644 --- a/src/gui/menuwindow.cpp +++ b/src/gui/menuwindow.cpp @@ -37,6 +37,7 @@ extern Window *inventoryWindow; extern Window *equipmentWindow; extern Window *skillDialog; extern Window *statusWindow; +extern Window *itemShortcutWindow; namespace { struct MenuWindowListener : public gcn::ActionListener @@ -62,6 +63,7 @@ MenuWindow::MenuWindow(): N_("Equipment"), N_("Inventory"), N_("Skills"), + N_("Shortcut"), N_("Setup"), 0 }; @@ -109,14 +111,20 @@ void MenuWindowListener::action(const gcn::ActionEvent &event) { window = skillDialog; } + else if (event.getId() == "Shortcut") + { + window = itemShortcutWindow; + } else if (event.getId() == "Setup") { window = setupWindow; } - if (window) { + if (window) + { window->setVisible(!window->isVisible()); - if (window->isVisible()) { + if (window->isVisible()) + { window->requestMoveToTop(); } } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 48bbd3d0..aeb6637d 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -200,12 +200,6 @@ void PopupMenu::handleLink(const std::string& link) setVisible(false); - /* - * This is need cause of a bug in guichan that leave - * the focus on the popup menu even if is not visible. - */ - _getFocusHandler()->focusNone(); - mBeing = NULL; mFloorItem = NULL; mItem = NULL; diff --git a/src/gui/selectionlistener.h b/src/gui/selectionlistener.h index b39672b5..917a4871 100644 --- a/src/gui/selectionlistener.h +++ b/src/gui/selectionlistener.h @@ -25,33 +25,23 @@ #define _TMW_SELECTIONLISTENER_H__ #include +#include /** * An event that characterizes a change in the current selection. * * \ingroup GUI */ -class SelectionEvent +class SelectionEvent : public gcn::Event { public: /** * Constructor. */ SelectionEvent(gcn::Widget *source): - mSource(source) + gcn::Event(source) { } - - /** - * The widget from which the event originated. - */ - gcn::Widget* getSource() const - { - return mSource; - } - - private: - gcn::Widget *mSource; }; /** diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index b601d70c..5f1011c1 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -44,58 +44,44 @@ SellDialog::SellDialog(): Window("Sell"), mMaxItems(0), mAmountItems(0) { + setResizable(true); + setMinWidth(260); + setMinHeight(230); + setDefaultSize(0, 0, 260, 230); + mShopItems = new ShopItems(); mShopItemList = new ShopListBox(mShopItems, mShopItems); - ScrollArea *scrollArea = new ScrollArea(mShopItemList); + mScrollArea = new ScrollArea(mShopItemList); mSlider = new Slider(1.0); mQuantityLabel = new gcn::Label("0"); mMoneyLabel = new gcn::Label("Money: 0 GP / Total: 0 GP"); - mItemDescLabel = new gcn::Label("Description:"); - mItemEffectLabel = new gcn::Label("Effect:"); mIncreaseButton = new Button("+", "+", this); mDecreaseButton = new Button("-", "-", this); mSellButton = new Button("Sell", "sell", this); - Button *quitButton = new Button("Quit", "quit", this); - mSellButton->setEnabled(false); - - setContentSize(260, 210); - scrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); - scrollArea->setDimension(gcn::Rectangle(5, 5, 250, 110)); - mShopItemList->setDimension(gcn::Rectangle(5, 5, 238, 110)); - - mSlider->setDimension(gcn::Rectangle(5, 120, 200, 10)); - mSlider->setEnabled(false); - - mQuantityLabel->setPosition(215, 120); + mQuitButton = new Button("Quit", "quit", this); + mItemDescLabel = new gcn::Label("Description:"); + mItemEffectLabel = new gcn::Label("Effect:"); - mIncreaseButton->setPosition(40, 186); mIncreaseButton->setSize(20, 20); - mIncreaseButton->setEnabled(false); - - mDecreaseButton->setPosition(10, 186); mDecreaseButton->setSize(20, 20); - mDecreaseButton->setEnabled(false); + mQuantityLabel->setWidth(60); - mMoneyLabel->setPosition(5, 130); - mItemEffectLabel->setDimension(gcn::Rectangle(5, 150, 240, 14)); - mItemDescLabel->setDimension(gcn::Rectangle(5, 169, 240, 14)); - - mSellButton->setPosition(175, 186); + mScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); + mIncreaseButton->setEnabled(false); + mDecreaseButton->setEnabled(false); mSellButton->setEnabled(false); + mSlider->setEnabled(false); - quitButton->setPosition(208, 186); - + mShopItemList->setPriceCheck(false); mShopItemList->setActionEventId("item"); mSlider->setActionEventId("slider"); - mShopItemList->setPriceCheck(false); - mShopItemList->addActionListener(this); mShopItemList->addSelectionListener(this); mSlider->addActionListener(this); - add(scrollArea); + add(mScrollArea); add(mSlider); add(mQuantityLabel); add(mMoneyLabel); @@ -104,8 +90,10 @@ SellDialog::SellDialog(): add(mIncreaseButton); add(mDecreaseButton); add(mSellButton); - add(quitButton); + add(mQuitButton); + addWindowListener(this); + loadWindowState("Sell"); setLocationRelativeTo(getParent()); } @@ -117,7 +105,7 @@ SellDialog::~SellDialog() void SellDialog::reset() { mShopItems->clear(); - mSlider->setValue(0.0); + mSlider->setValue(0); // Reset previous selected item to prevent failing asserts mShopItemList->setSelected(-1); @@ -135,16 +123,11 @@ void SellDialog::action(const gcn::ActionEvent &event) { int selectedItem = mShopItemList->getSelected(); - if (event.getId() == "item") - { - mAmountItems = 0; - mSlider->setValue(0); - updateButtonsAndLabels(); - } - else if (event.getId() == "quit") + if (event.getId() == "quit") { setVisible(false); current_npc = 0; + return; } // The following actions require a valid item selection @@ -156,21 +139,19 @@ void SellDialog::action(const gcn::ActionEvent &event) if (event.getId() == "slider") { - mAmountItems = (int) (mSlider->getValue() * mMaxItems); + mAmountItems = (int) mSlider->getValue(); updateButtonsAndLabels(); } else if (event.getId() == "+" && mAmountItems < mMaxItems) { mAmountItems++; - - mSlider->setValue((double) mAmountItems /(double) mMaxItems); + mSlider->setValue(mAmountItems); updateButtonsAndLabels(); } - else if (event.getId() == "-" && mAmountItems > 0) + else if (event.getId() == "-" && mAmountItems > 1) { mAmountItems--; - - mSlider->setValue((double) mAmountItems / (double) mMaxItems); + mSlider->setValue(mAmountItems); updateButtonsAndLabels(); } else if (event.getId() == "sell" && mAmountItems > 0 @@ -182,8 +163,7 @@ void SellDialog::action(const gcn::ActionEvent &event) mMaxItems -= mAmountItems; mShopItems->getShop()->at(selectedItem).quantity = mMaxItems; mPlayerMoney += (mAmountItems * mShopItems->at(selectedItem).price); - mAmountItems = 0; - mSlider->setValue(0); + mAmountItems = 1; if (!mMaxItems) { @@ -194,6 +174,7 @@ void SellDialog::action(const gcn::ActionEvent &event) } else { + mSlider->gcn::Slider::setScale(1, mMaxItems); // Update only when there are items left, the entry doesn't exist // otherwise and can't be updated updateButtonsAndLabels(); @@ -204,10 +185,54 @@ void SellDialog::action(const gcn::ActionEvent &event) void SellDialog::selectionChanged(const SelectionEvent &event) { // Reset amount of items and update labels - mAmountItems = 0; + mAmountItems = 1; mSlider->setValue(0); updateButtonsAndLabels(); + mSlider->gcn::Slider::setScale(1, mMaxItems); +} + +void SellDialog::windowResized(const WindowEvent &event) +{ + gcn::Rectangle area = getChildrenArea(); + int width = area.width; + int height = area.height; + + mDecreaseButton->setPosition(8, height - 8 - mDecreaseButton->getHeight()); + mIncreaseButton->setPosition( + mDecreaseButton->getX() + mDecreaseButton->getWidth() + 5, + mDecreaseButton->getY()); + + mQuitButton->setPosition( + width - 8 - mQuitButton->getWidth(), + height - 8 - mQuitButton->getHeight()); + mSellButton->setPosition( + mQuitButton->getX() - 5 - mSellButton->getWidth(), + mQuitButton->getY()); + + mItemDescLabel->setDimension(gcn::Rectangle(8, + mSellButton->getY() - 5 - mItemDescLabel->getHeight(), + width - 16, + mItemDescLabel->getHeight())); + mItemEffectLabel->setDimension(gcn::Rectangle(8, + mItemDescLabel->getY() - 5 - mItemEffectLabel->getHeight(), + width - 16, + mItemEffectLabel->getHeight())); + mMoneyLabel->setDimension(gcn::Rectangle(8, + mItemEffectLabel->getY() - 5 - mMoneyLabel->getHeight(), + width - 16, + mMoneyLabel->getHeight())); + + mQuantityLabel->setPosition( + width - mQuantityLabel->getWidth() - 8, + mMoneyLabel->getY() - 5 - mQuantityLabel->getHeight()); + mSlider->setDimension(gcn::Rectangle(8, + mQuantityLabel->getY(), + mQuantityLabel->getX() - 8 - 8, + 10)); + + mScrollArea->setDimension(gcn::Rectangle(8, 8, width - 16, + mSlider->getY() - 5 - 8)); } void SellDialog::setMoney(int amount) @@ -246,15 +271,13 @@ SellDialog::updateButtonsAndLabels() // Update Buttons and slider mSellButton->setEnabled(mAmountItems > 0); - mDecreaseButton->setEnabled(mAmountItems > 0); + mDecreaseButton->setEnabled(mAmountItems > 1); mIncreaseButton->setEnabled(mAmountItems < mMaxItems); - mSlider->setEnabled(selectedItem > -1); + mSlider->setEnabled(mMaxItems > 1); // Update the quantity and money labels mQuantityLabel->setCaption( toString(mAmountItems) + " / " + toString(mMaxItems)); - mQuantityLabel->adjustSize(); mMoneyLabel->setCaption("Money: " + toString(income) + " GP / Total: " + toString(mPlayerMoney + income) + " GP"); - mMoneyLabel->adjustSize(); } diff --git a/src/gui/sell.h b/src/gui/sell.h index fc42fd1c..d1e2ddd2 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -28,6 +28,7 @@ #include "window.h" #include "selectionlistener.h" +#include "windowlistener.h" #include "../guichanfwd.h" @@ -40,7 +41,8 @@ class ShopListBox; * * \ingroup Interface */ -class SellDialog : public Window, gcn::ActionListener, SelectionListener +class SellDialog : public Window, gcn::ActionListener, SelectionListener, + WindowListener { public: /** @@ -77,22 +79,28 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener */ void selectionChanged(const SelectionEvent &event); + /** + * Called whenever the window is resized. + */ + void windowResized(const WindowEvent &event); + /** * Gives Player's Money amount */ void setMoney(int amount); + private: /** * Updates the state of buttons and labels. */ - void - updateButtonsAndLabels(); + void updateButtonsAndLabels(); - private: gcn::Button *mSellButton; + gcn::Button *mQuitButton; gcn::Button *mIncreaseButton; gcn::Button *mDecreaseButton; ShopListBox *mShopItemList; + gcn::ScrollArea *mScrollArea; gcn::Label *mMoneyLabel; gcn::Label *mItemDescLabel; gcn::Label *mItemEffectLabel; diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 3ea19059..6a13232a 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -27,6 +27,7 @@ #include "setup_audio.h" #include "setup_joystick.h" #include "setup_video.h" +#include "setup_keyboard.h" #include "tabbedcontainer.h" #include "../utils/dtor.h" @@ -43,7 +44,8 @@ extern Window *skillDialog; Setup::Setup(): Window(_("Setup")) { - int width = 230; + setCloseButton(true); + int width = 250; int height = 245; setContentSize(width, height); @@ -59,7 +61,7 @@ Setup::Setup(): } TabbedContainer *panel = new TabbedContainer(); - panel->setDimension(gcn::Rectangle(5, 5, 220, 205)); + panel->setDimension(gcn::Rectangle(5, 5, 250, 205)); panel->setOpaque(false); SetupTab *tab; @@ -76,6 +78,10 @@ Setup::Setup(): panel->addTab(tab, _("Joystick")); mTabs.push_back(tab); + tab = new Setup_Keyboard(); + panel->addTab(tab, "Keyboard"); + mTabs.push_back(tab); + add(panel); setLocationRelativeTo(getParent()); diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp new file mode 100644 index 00000000..e88080b5 --- /dev/null +++ b/src/gui/setup_keyboard.cpp @@ -0,0 +1,187 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "setup_keyboard.h" + +#include +#include + +#include "button.h" +#include "listbox.h" +#include "ok_dialog.h" +#include "scrollarea.h" + +#include "../configuration.h" +#include "../keyboardconfig.h" + +#include "../utils/tostring.h" + +#include + +/** + * The list model for key function list. + * + * \ingroup Interface + */ +class KeyListModel : public gcn::ListModel +{ + public: + /** + * Returns the number of elements in container. + */ + int getNumberOfElements() { return keyboard.KEY_TOTAL; } + + /** + * Returns element from container. + */ + std::string getElementAt(int i) { return mKeyFunctions[i]; } + + /** + * Sets element from container. + */ + void setElementAt(int i, std::string caption) + { + mKeyFunctions[i] = caption; + } + + private: + std::string mKeyFunctions[KeyboardConfig::KEY_TOTAL]; +}; + +Setup_Keyboard::Setup_Keyboard(): + mKeyListModel(new KeyListModel()), + mKeyList(new ListBox(mKeyListModel)), + mKeySetting(false) +{ + keyboard.setSetupKeyboard(this); + setOpaque(false); + + refreshKeys(); + + mKeyList->setDimension(gcn::Rectangle(0, 0, 185, 140)); + mKeyList->addActionListener(this); + mKeyList->setSelected(-1); + + ScrollArea *scrollArea = new ScrollArea(mKeyList); + scrollArea->setDimension(gcn::Rectangle(10, 10, 200, 140)); + add(scrollArea); + + mAssignKeyButton = new Button("Assign", "assign", this); + mAssignKeyButton->setPosition(165, 155); + mAssignKeyButton->addActionListener(this); + mAssignKeyButton->setEnabled(false); + add(mAssignKeyButton); + + mMakeDefaultButton = new Button("Default", "makeDefault", this); + mMakeDefaultButton->setPosition(10, 155); + mMakeDefaultButton->addActionListener(this); + add(mMakeDefaultButton); +} + +Setup_Keyboard::~Setup_Keyboard() +{ + delete mKeyList; + delete mKeyListModel; + + delete mAssignKeyButton; + delete mMakeDefaultButton; +} + +void Setup_Keyboard::apply() +{ + keyUnresolved(); + + if (keyboard.hasConflicts()) + { + new OkDialog("Key Conflict(s) Detected.", + "Resolve them, or gameplay may result in strange behaviour."); + } + keyboard.setEnabled(true); + keyboard.store(); +} + +void Setup_Keyboard::cancel() +{ + keyUnresolved(); + + keyboard.retrieve(); + keyboard.setEnabled(true); + + refreshKeys(); +} + +void Setup_Keyboard::action(const gcn::ActionEvent &event) +{ + if (event.getSource() == mKeyList) + { + if (!mKeySetting) { + mAssignKeyButton->setEnabled(true); + } + } + else if (event.getId() == "assign") + { + mKeySetting = true; + mAssignKeyButton->setEnabled(false); + keyboard.setEnabled(false); + int i(mKeyList->getSelected()); + keyboard.setNewKeyIndex(i); + mKeyListModel->setElementAt(i, keyboard.getKeyCaption(i) + ": ?"); + } + else if (event.getId() == "makeDefault") + { + keyboard.makeDefault(); + refreshKeys(); + } +} + +void Setup_Keyboard::refreshAssignedKey(int index) +{ + std::string caption; + char *temp = SDL_GetKeyName( + (SDLKey) keyboard.getKeyValue(index)); + caption = keyboard.getKeyCaption(index) + ": " + toString(temp); + mKeyListModel->setElementAt(index, caption); +} + +void Setup_Keyboard::newKeyCallback(int index) +{ + mKeySetting = false; + refreshAssignedKey(index); + mAssignKeyButton->setEnabled(true); +} + +void Setup_Keyboard::refreshKeys() +{ + for(int i = 0; i < keyboard.KEY_TOTAL; i++) + { + refreshAssignedKey(i); + } +} + +void Setup_Keyboard::keyUnresolved() +{ + if (mKeySetting) { + newKeyCallback(keyboard.getNewKeyIndex()); + keyboard.setNewKeyIndex(keyboard.KEY_NO_VALUE); + } +} diff --git a/src/gui/setup_keyboard.h b/src/gui/setup_keyboard.h new file mode 100644 index 00000000..b72e8746 --- /dev/null +++ b/src/gui/setup_keyboard.h @@ -0,0 +1,84 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_GUI_SETUP_KEYBOARD_H +#define _TMW_GUI_SETUP_KEYBOARD_H + +#include "setuptab.h" +#include "button.h" +#include "../guichanfwd.h" + +#include + + +#include + +class Setup_Keyboard : public SetupTab, public gcn::ActionListener +{ + public: + /** + * Constructor + */ + Setup_Keyboard(); + + /** + * Destructor + */ + ~Setup_Keyboard(); + + void apply(); + void cancel(); + + void action(const gcn::ActionEvent &event); + + /** + * Get an update on the assigned key. + */ + void refreshAssignedKey(int index); + + /** + * The callback function when a new key has been pressed. + */ + void newKeyCallback(int index); + + /** + * Shorthand method to update all the keys. + */ + void refreshKeys(); + + /** + * If a key function is unresolved, then this reverts it. + */ + void keyUnresolved(); + + private: + class KeyListModel *mKeyListModel; + gcn::ListBox *mKeyList; + + gcn::Button *mAssignKeyButton; + gcn::Button *mMakeDefaultButton; + + bool mKeySetting; /**< flag to check if key being set. */ +}; + +#endif diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index 0e2ea6d3..ae787ab7 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -129,24 +129,8 @@ void ShopListBox::mousePressed(gcn::MouseEvent &event) { if (event.getButton() == gcn::MouseEvent::LEFT) { - bool enoughMoney = false; - int y = event.getY(); - - if (mShopItems && mPriceCheck) - { - if (mPlayerMoney >= mShopItems->at(y / mRowHeight).price) - enoughMoney = true; - } - else // Old Behaviour - { - enoughMoney = true; - } - - if (enoughMoney) - { - setSelected(y / mRowHeight); - generateAction(); - } + setSelected(event.getY() / mRowHeight); + generateAction(); } } diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 884b3744..d5cfe76a 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -63,22 +63,18 @@ const char *skill_db[] = { SkillDialog::SkillDialog(): Window("Skills") { + setCloseButton(true); setDefaultSize(windowContainer->getWidth() - 255, 25, 240, 240); mSkillListBox = new ListBox(this); ScrollArea *skillScrollArea = new ScrollArea(mSkillListBox); - mCloseButton = new Button("Close", "close", this); mSkillListBox->setActionEventId("skill"); skillScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); skillScrollArea->setDimension(gcn::Rectangle(5, 5, 230, 180)); - mCloseButton->setPosition( - skillScrollArea->getX() + skillScrollArea->getWidth() - mCloseButton->getWidth(), - 210); add(skillScrollArea); - add(mCloseButton); mSkillListBox->addActionListener(this); diff --git a/src/gui/skill.h b/src/gui/skill.h index b8794e35..f1a14d50 100644 --- a/src/gui/skill.h +++ b/src/gui/skill.h @@ -71,7 +71,6 @@ class SkillDialog : public Window, public gcn::ActionListener, private: gcn::ListBox *mSkillListBox; - gcn::Button *mCloseButton; std::vector mSkillList; }; diff --git a/src/gui/status.cpp b/src/gui/status.cpp index 7da3b905..323a6b16 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -39,6 +39,7 @@ StatusWindow::StatusWindow(LocalPlayer *player): mPlayer(player) { setResizable(true); + setCloseButton(true); setDefaultSize((windowContainer->getWidth() - 365) / 2, (windowContainer->getHeight() - 255) / 2, 365, 280); loadWindowState("Status"); @@ -219,7 +220,7 @@ void StatusWindow::update() mHpBar->setColor(0, 171, 34); // Green } - mHpBar->setProgress((float)hp / maxHp); + mHpBar->setProgress((float) hp / maxHp); // Stats Part // ---------- @@ -235,7 +236,8 @@ void StatusWindow::update() int statusPoints = mPlayer->getAttributeIncreasePoints(); // Update labels - for (int i = 0; i < 7; i++) { + for (int i = 0; i < 7; i++) + { mStatsLabel[i]->setCaption(attrNames[i]); mStatsDisplayLabel[i]->setCaption( strprintf("%d / %d", diff --git a/src/gui/status.h b/src/gui/status.h index 40d25a2a..62cd8805 100644 --- a/src/gui/status.h +++ b/src/gui/status.h @@ -41,7 +41,8 @@ class ProgressBar; * * \ingroup Interface */ -class StatusWindow : public Window, public gcn::ActionListener { +class StatusWindow : public Window, public gcn::ActionListener +{ public: /** * Constructor. diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index ed75e5b3..5d81bb9c 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -46,6 +46,8 @@ #include "../resources/resourcemanager.h" +extern std::string homeDir; + /** * Calculates the Alder-32 checksum for the given file. */ @@ -119,7 +121,7 @@ UpdaterWindow::UpdaterWindow(): mUpdateHost = config.getValue("updatehost", "http://updates.themanaworld.org"); - mBasePath = config.getValue("homeDir", "."); + mBasePath = homeDir; // Try to download the updates list download(); diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 2af1d960..4c6b04a2 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -55,8 +55,7 @@ Viewport::Viewport(): mCameraX(0), mCameraY(0), mShowDebugPath(false), - mPlayerFollowMouse(false), - mPopupActive(false) + mPlayerFollowMouse(false) { setOpaque(false); addMouseListener(this); @@ -372,21 +371,20 @@ Viewport::mousePressed(gcn::MouseEvent &event) if ((being = beingManager->findBeing(tilex, tiley)) && being->getType() != Being::LOCALPLAYER) { - showPopup(event.getX(), event.getY(), being); + mPopupMenu->showPopup(event.getX(), event.getY(), being); return; } else if((floorItem = floorItemManager->findByCoordinates(tilex, tiley))) { - showPopup(event.getX(), event.getY(), floorItem); + mPopupMenu->showPopup(event.getX(), event.getY(), floorItem); return; } } // If a popup is active, just remove it - if (mPopupActive) + if (mPopupMenu->isVisible()) { mPopupMenu->setVisible(false); - mPopupActive = false; return; } @@ -450,21 +448,6 @@ void Viewport::showPopup(int x, int y, Item *item) { mPopupMenu->showPopup(x, y, item); - mPopupActive = true; -} - -void -Viewport::showPopup(int x, int y, FloorItem *floorItem) -{ - mPopupMenu->showPopup(x, y, floorItem); - mPopupActive = true; -} - -void -Viewport::showPopup(int x, int y, Being *being) -{ - mPopupMenu->showPopup(x, y, being); - mPopupActive = true; } void diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 22d0f249..eeb31bae 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -129,18 +129,6 @@ class Viewport : public WindowContainer, public gcn::MouseListener, getCameraY() { return mCameraY; } private: - /** - * Shows a popup for a floor item. - * TODO Find some way to get rid of FloorItem here - */ - void showPopup(int x, int y, FloorItem *floorItem); - - /** - * Shows a popup for a being. - * TODO Find some way to get rid of Being here - */ - void showPopup(int x, int y, Being *being); - /** * Helper function for loading target cursors */ @@ -187,7 +175,6 @@ class Viewport : public WindowContainer, public gcn::MouseListener, int mWalkTime; PopupMenu *mPopupMenu; /**< Popup menu. */ - bool mPopupActive; }; #endif diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 84f4466c..17447009 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -26,6 +26,7 @@ #include #include +#include "gui.h" #include "gccontainer.h" #include "windowcontainer.h" @@ -42,7 +43,9 @@ ConfigListener *Window::windowConfigListener = 0; WindowContainer *Window::windowContainer = 0; int Window::instances = 0; +int Window::mouseResize = 0; ImageRect Window::border; +Image *Window::closeImage = NULL; class WindowConfigListener : public ConfigListener { @@ -60,7 +63,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent): mParent(parent), mModal(modal), mResizable(false), - mMouseResize(0), + mCloseButton(false), mSticky(false), mMinWinWidth(100), mMinWinHeight(40), @@ -88,6 +91,8 @@ Window::Window(const std::string& caption, bool modal, Window *parent): border.grid[7] = dBorders->getSubImage(4, 15, 3, 4); border.grid[8] = dBorders->getSubImage(7, 15, 4, 4); dBorders->decRef(); + closeImage = resman->getImage("graphics/gui/close_button.png"); + windowConfigListener = new WindowConfigListener(); // Send GUI alpha changed for initialization windowConfigListener->optionChanged("guialpha"); @@ -110,6 +115,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent): if (mModal) { + gui->setCursorType(Gui::CURSOR_POINTER); requestModalFocus(); } @@ -153,6 +159,7 @@ Window::~Window() delete border.grid[6]; delete border.grid[7]; delete border.grid[8]; + closeImage->decRef(); } delete mChrome; @@ -173,11 +180,19 @@ void Window::draw(gcn::Graphics *graphics) // Draw title if (getTitleBarHeight()) { - graphics->setColor(gcn::Color(0, 0, 0)); - graphics->setFont(getFont()); - graphics->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT); + g->setColor(gcn::Color(0, 0, 0)); + g->setFont(getFont()); + g->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT); } + // Draw Close Button + if (mCloseButton) + { + g->drawImage(closeImage, + getWidth() - closeImage->getWidth() - getPadding(), + getPadding() + ); + } drawChildren(graphics); } @@ -207,6 +222,8 @@ void Window::setWidth(int width) { mGrip->setX(getWidth() - mGrip->getWidth() - getChildrenArea().x); } + + fireWindowEvent(WindowEvent(this, WindowEvent::WINDOW_RESIZED)); } void Window::setHeight(int height) @@ -217,6 +234,8 @@ void Window::setHeight(int height) { mGrip->setY(getHeight() - mGrip->getHeight() - getChildrenArea().y); } + + fireWindowEvent(WindowEvent(this, WindowEvent::WINDOW_RESIZED)); } void Window::setDimension(const gcn::Rectangle &dimension) @@ -228,6 +247,27 @@ void Window::setDimension(const gcn::Rectangle &dimension) mGrip->setX(getWidth() - mGrip->getWidth() - getChildrenArea().x); mGrip->setY(getHeight() - mGrip->getHeight() - getChildrenArea().y); } + + fireWindowEvent(WindowEvent(this, WindowEvent::WINDOW_RESIZED)); + fireWindowEvent(WindowEvent(this, WindowEvent::WINDOW_MOVED)); +} + +void Window::setPosition(int x, int y) +{ + gcn::Window::setPosition(x, y); + fireWindowEvent(WindowEvent(this, WindowEvent::WINDOW_MOVED)); +} + +void Window::setX(int x) +{ + gcn::Window::setX(x); + fireWindowEvent(WindowEvent(this, WindowEvent::WINDOW_MOVED)); +} + +void Window::setY(int y) +{ + gcn::Window::setY(y); + fireWindowEvent(WindowEvent(this, WindowEvent::WINDOW_MOVED)); } void Window::setLocationRelativeTo(gcn::Widget *widget) @@ -280,6 +320,11 @@ void Window::setResizable(bool r) } } +void Window::setCloseButton(bool flag) +{ + mCloseButton = flag; +} + bool Window::isResizable() { return mResizable; @@ -327,27 +372,73 @@ void Window::mousePressed(gcn::MouseEvent &event) // Let Guichan move window to top and figure out title bar drag gcn::Window::mousePressed(event); - const int x = event.getX(); - const int y = event.getY(); - mMouseResize = 0; + if (event.getButton() == gcn::MouseEvent::LEFT) + { + const int x = event.getX(); + const int y = event.getY(); + + // Handle close button + if (mCloseButton) + { + gcn::Rectangle closeButtonRect( + getWidth() - closeImage->getWidth() - getPadding(), + getPadding(), + closeImage->getWidth(), + closeImage->getHeight()); + + if (closeButtonRect.isPointInRect(x, y)) + { + setVisible(false); + } + } + + // Handle window resizing + mouseResize = getResizeHandles(event); + } +} + +void Window::mouseReleased(gcn::MouseEvent &event) +{ + if (mResizable && mouseResize) + { + mouseResize = 0; + gui->setCursorType(Gui::CURSOR_POINTER); + } + + // This should be the responsibility of Guichan (and is from 0.8.0 on) + mIsMoving = false; +} - // Activate resizing handles as appropriate - if (event.getSource() == this && isResizable() && - event.getButton() == gcn::MouseEvent::LEFT && - !getChildrenArea().isPointInRect(x, y)) +void Window::mouseExited(gcn::MouseEvent &event) +{ + if (mResizable && !mouseResize) { - mMouseResize |= (x > getWidth() - resizeBorderWidth) ? RIGHT : - (x < resizeBorderWidth) ? LEFT : 0; - mMouseResize |= (y > getHeight() - resizeBorderWidth) ? BOTTOM : - (y < resizeBorderWidth) ? TOP : 0; + gui->setCursorType(Gui::CURSOR_POINTER); } - else if (event.getSource() == mGrip && - event.getButton() == gcn::MouseEvent::LEFT) +} + +void Window::mouseMoved(gcn::MouseEvent &event) +{ + int resizeHandles = getResizeHandles(event); + + // Changes the custom mouse cursor based on it's current position. + switch (resizeHandles) { - mDragOffsetX = x; - mDragOffsetY = y; - mMouseResize |= BOTTOM | RIGHT; - mIsMoving = false; + case BOTTOM | RIGHT: + gui->setCursorType(Gui::CURSOR_RESIZE_DOWN_RIGHT); + break; + case BOTTOM | LEFT: + gui->setCursorType(Gui::CURSOR_RESIZE_DOWN_LEFT); + break; + case BOTTOM: + gui->setCursorType(Gui::CURSOR_RESIZE_DOWN); + break; + case RIGHT: + case LEFT: + gui->setCursorType(Gui::CURSOR_RESIZE_ACROSS); + break; + default: + gui->setCursorType(Gui::CURSOR_POINTER); } } @@ -366,31 +457,31 @@ void Window::mouseDragged(gcn::MouseEvent &event) setPosition(newX, newY); } - if (mMouseResize && !mIsMoving) + if (mouseResize && !mIsMoving) { const int dx = event.getX() - mDragOffsetX; const int dy = event.getY() - mDragOffsetY; gcn::Rectangle newDim = getDimension(); - if (mMouseResize & (TOP | BOTTOM)) + if (mouseResize & (TOP | BOTTOM)) { - int newHeight = newDim.height + ((mMouseResize & TOP) ? -dy : dy); + int newHeight = newDim.height + ((mouseResize & TOP) ? -dy : dy); newDim.height = std::min(mMaxWinHeight, std::max(mMinWinHeight, newHeight)); - if (mMouseResize & TOP) + if (mouseResize & TOP) { newDim.y -= newDim.height - getHeight(); } } - if (mMouseResize & (LEFT | RIGHT)) + if (mouseResize & (LEFT | RIGHT)) { - int newWidth = newDim.width + ((mMouseResize & LEFT) ? -dx : dx); + int newWidth = newDim.width + ((mouseResize & LEFT) ? -dx : dx); newDim.width = std::min(mMaxWinWidth, std::max(mMinWinWidth, newWidth)); - if (mMouseResize & LEFT) + if (mouseResize & LEFT) { newDim.x -= newDim.width - getWidth(); } @@ -417,11 +508,11 @@ void Window::mouseDragged(gcn::MouseEvent &event) } // Update mouse offset when dragging bottom or right border - if (mMouseResize & BOTTOM) + if (mouseResize & BOTTOM) { mDragOffsetY += newDim.height - getHeight(); } - if (mMouseResize & RIGHT) + if (mouseResize & RIGHT) { mDragOffsetX += newDim.width - getWidth(); } @@ -469,3 +560,50 @@ void Window::resetToDefaultSize() setContentSize(mDefaultWidth, mDefaultHeight); updateContentSize(); } + +int Window::getResizeHandles(gcn::MouseEvent &event) +{ + int resizeHandles = 0; + const int y = event.getY(); + + if (mResizable && y > (int) mTitleBarHeight) + { + const int x = event.getX(); + + if (!getChildrenArea().isPointInRect(x, y) && + event.getSource() == this) + { + resizeHandles |= (x > getWidth() - resizeBorderWidth) ? RIGHT : + (x < resizeBorderWidth) ? LEFT : 0; + resizeHandles |= (y > getHeight() - resizeBorderWidth) ? BOTTOM : + (y < resizeBorderWidth) ? TOP : 0; + } + + if (event.getSource() == mGrip) + { + mDragOffsetX = x; + mDragOffsetY = y; + resizeHandles |= BOTTOM | RIGHT; + } + } + + return resizeHandles; +} + +void Window::fireWindowEvent(const WindowEvent &event) +{ + WindowListeners::iterator i_end = mListeners.end(); + WindowListeners::iterator i = mListeners.begin(); + + switch (event.getType()) + { + case WindowEvent::WINDOW_MOVED: + for (; i != i_end; ++i) + { (*i)->windowMoved(event); } + break; + case WindowEvent::WINDOW_RESIZED: + for (; i != i_end; ++i) + { (*i)->windowResized(event); } + break; + } +} diff --git a/src/gui/window.h b/src/gui/window.h index 1ba23fb2..ab266422 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -28,11 +28,14 @@ #include "../guichanfwd.h" +#include "windowlistener.h" + class ConfigListener; class GCContainer; class ImageRect; class ResizeGrip; class WindowContainer; +class Image; /** * A window. This window can be dragged around and has a title bar. Windows are @@ -119,16 +122,36 @@ class Window : public gcn::Window */ void setDimension(const gcn::Rectangle &dimension); + /** + * Sets the position of this window. + */ + void setPosition(int x, int y); + + /** + * Sets the window x coordinate. + */ + void setX(int x); + + /** + * Sets the window y coordinate. + */ + void setY(int y); + /** * Sets the location relative to the given widget. */ void setLocationRelativeTo(gcn::Widget *widget); /** - * Sets whether of not the window can be resized. + * Sets whether or not the window can be resized. */ void setResizable(bool resize); + /** + * Sets whether or not the window has a close button. + */ + void setCloseButton(bool flag); + /** * Returns whether the window can be resized. */ @@ -155,9 +178,14 @@ class Window : public gcn::Window void setMaxHeight(unsigned int height); /** - * Sets whether the window is sticky. - * A sticky window will not have its visibility set to false - * on a general setVisible(false) call. + * Sets flag to show a title or not. + */ + void setShowTitle(bool flag) + { mShowTitle = flag; } + + /** + * Sets whether the window is sticky. A sticky window will not have + * its visibility set to false on a general setVisible(false) call. */ void setSticky(bool sticky); @@ -167,10 +195,9 @@ class Window : public gcn::Window bool isSticky(); /** - * Overloads window setVisible by guichan to allow sticky window - * Handling + * Overloads window setVisible by Guichan to allow sticky window + * handling. */ - void setVisible(bool visible); /** @@ -198,6 +225,24 @@ class Window : public gcn::Window */ void mouseDragged(gcn::MouseEvent &event); + /** + * Implements custom cursor image changing context, based on mouse + * relative position. + */ + void mouseMoved(gcn::MouseEvent &event); + + /** + * When the mouse button has been let go, this ensures that the mouse + * custom cursor is restored back to it's standard image. + */ + void mouseReleased(gcn::MouseEvent &event); + + /** + * When the mouse leaves the window this ensures that the custom cursor + * is restored back to it's standard image. + */ + void mouseExited(gcn::MouseEvent &event); + /** * Read the x, y, and width and height for resizables in the config * based on the given string. @@ -216,11 +261,25 @@ class Window : public gcn::Window int defaultWidth, int defaultHeight); /** - * Reset the win pos and size to default. - * Don't forget to set defaults first. + * Reset the win pos and size to default. Don't forget to set defaults + * first. */ void resetToDefaultSize(); + /** + * Adds a listener to the list that's notified when the window is + * moved or resized. + */ + void addWindowListener(WindowListener *listener) + { mListeners.push_back(listener); } + + /** + * Removes a listener from the list that's notified when the window is + * moved or resized. + */ + void removeWindowListener(WindowListener *listener) + { mListeners.remove(listener); } + enum ResizeHandles { TOP = 0x01, @@ -233,13 +292,23 @@ class Window : public gcn::Window static WindowContainer *windowContainer; private: + /** + * Determines if the mouse is in a resize area and returns appropriate + * resize handles. Also initializes drag offset in case the resize + * grip is used. + * + * @see ResizeHandles + */ + int getResizeHandles(gcn::MouseEvent &event); + GCContainer *mChrome; /**< Contained container */ ResizeGrip *mGrip; /**< Resize grip */ Window *mParent; /**< The parent window */ std::string mConfigName; /**< Name used for saving window-related data */ + bool mShowTitle; /**< Window has a title bar */ bool mModal; /**< Window is modal */ bool mResizable; /**< Window can be resized */ - int mMouseResize; /**< Window is being resized */ + bool mCloseButton; /**< Window has a close button */ bool mSticky; /**< Window resists minimization */ int mMinWinWidth; /**< Minimum window width */ int mMinWinHeight; /**< Minimum window height */ @@ -255,8 +324,10 @@ class Window : public gcn::Window */ static ConfigListener *windowConfigListener; + static int mouseResize; /**< Active resize handles */ static int instances; /**< Number of Window instances */ static ImageRect border; /**< The window border and background */ + static Image *closeImage; /**< Close Button Image */ /** * The width of the resize border. Is independent of the actual window @@ -264,6 +335,14 @@ class Window : public gcn::Window * where two borders are moved at the same time. */ static const int resizeBorderWidth = 10; + + private: + /** + * Sends out a window event to the list of selection listeners. + */ + void fireWindowEvent(const WindowEvent &event); + + WindowListeners mListeners; }; #endif diff --git a/src/gui/windowlistener.h b/src/gui/windowlistener.h new file mode 100644 index 00000000..08aab71d --- /dev/null +++ b/src/gui/windowlistener.h @@ -0,0 +1,86 @@ +/* + * The Mana World + * Copyright 2004 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_WINDOW_LISTENER_H_ +#define _TMW_WINDOW_LISTENER_H_ + +#include +#include + +/** + * An event that characterizes a window move or resize. + * + * \ingroup GUI + */ +class WindowEvent : public gcn::Event +{ + public: + /** + * Constructor. + */ + WindowEvent(gcn::Window *source, int type): + gcn::Event(source) + { + mType = type; + } + + /** + * Returns the event type. + */ + int getType() const + { return mType; } + + enum WindowEventType + { + WINDOW_MOVED, + WINDOW_RESIZED + }; +}; + +/** + * The listener that's notified when a window is moved or resized. + * + * \ingroup GUI + */ +class WindowListener +{ + public: + /** + * Virtual destructor. + */ + virtual ~WindowListener() {} + + /** + * Called whenever the window is moved. + */ + virtual void windowMoved(const WindowEvent &event) {} + + /** + * Called whenever the window is resized. + */ + virtual void windowResized(const WindowEvent &event) {} +}; + +typedef std::list WindowListeners; + +#endif diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp index 35cc21ad..17581a2a 100644 --- a/src/imageparticle.cpp +++ b/src/imageparticle.cpp @@ -31,12 +31,12 @@ ImageParticle::ImageParticle(Map *map, Image *image): Particle(map), mImage(image) { - mImage->incRef(); + if (mImage) mImage->incRef(); } ImageParticle::~ImageParticle() { - mImage->decRef(); + if (mImage) mImage->decRef(); } void ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const @@ -44,8 +44,8 @@ void ImageParticle::draw(Graphics *graphics, int offsetX, int offsetY) const if (!mAlive) return; - int screenX = (int) mPosX + offsetX - mImage->getWidth() / 2; - int screenY = (int) mPosY - (int) mPosZ + offsetY - mImage->getHeight()/2; + int screenX = (int) mPos.x + offsetX - mImage->getWidth() / 2; + int screenY = (int) mPos.y - (int)mPos.z + offsetY - mImage->getHeight()/2; // Check if on screen if (screenX + mImage->getWidth() < 0 || diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp new file mode 100644 index 00000000..8a514c7e --- /dev/null +++ b/src/itemshortcut.cpp @@ -0,0 +1,87 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#include "itemshortcut.h" + +#include "localplayer.h" +#include "configuration.h" + +#include "utils/tostring.h" + +ItemShortcut::ItemShortcut *itemShortcut; + +ItemShortcut::ItemShortcut(): + mItemSelected(NULL) +{ + for (int i = 0; i < SHORTCUT_ITEMS; i++) + { + mItems[i] = NULL; + } +} + +ItemShortcut::~ItemShortcut() +{ + save(); +} + +void ItemShortcut::load() +{ + for (int i = 0; i < SHORTCUT_ITEMS; i++) + { + int itemId = (int) config.getValue("itemShortcut" + toString(i), -1); + + if (itemId != -1) + { + ItemPtr item = player_node->searchForItem(itemId); + if (item) + { + mItems[i] = item; + } + } + } +} + +void ItemShortcut::save() +{ + for (int i = 0; i < SHORTCUT_ITEMS; i++) + { + if (mItems[i]) + { + config.setValue("shortcut" + toString(i), mItems[i]->getId()); + } + else + { + config.setValue("shortcut" + toString(i), -1); + } + } +} + +void ItemShortcut::useItem(int index) +{ + if (mItems[index]) + { + if (mItems[index]->getQuantity()) { + // TODO: Fix this (index vs. pointer mismatch) + //player_node->useItem(mItems[index]); + } + } +} diff --git a/src/itemshortcut.h b/src/itemshortcut.h new file mode 100644 index 00000000..d211c7f3 --- /dev/null +++ b/src/itemshortcut.h @@ -0,0 +1,130 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef _TMW_ITEMSHORTCUT_H__ +#define _TMW_ITEMSHORTCUT_H__ + +#include "item.h" + +#define SHORTCUT_ITEMS 10 + +/** + * The item pointer + */ +typedef Item* ItemPtr; + +class ItemShortcut +{ + public: + /** + * Constructor. + */ + ItemShortcut(); + + /** + * Destructor. + */ + ~ItemShortcut(); + + /** + * Load the configuration information. + */ + void load(); + + /** + * Returns the shortcut item specified by the index. + * + * @param index Index of the shortcut item. + */ + ItemPtr getItem(int index) const + { return mItems[index]; } + + /** + * Returns the amount of shortcut items. + */ + int getItemCount() const + { return SHORTCUT_ITEMS; } + + /** + * Returns the item that is currently selected. + */ + ItemPtr getItemSelected() const + { return mItemSelected; } + + /** + * Adds the selected item to the items specified by the index. + * + * @param index Index of the items. + */ + void setItem(int index) + { mItems[index] = mItemSelected; } + + /** + * Adds an item to the items store specified by the index. + * + * @param index Index of the items. + * @param item Item to store. + */ + void setItems(int index, Item *item) + { mItems[index] = item; } + + /** + * Set the item that is selected. + * + * @param item The item that is to be assigned. + */ + void setItemSelected(ItemPtr item) + { mItemSelected = item; } + + /** + * A flag to check if the item is selected. + */ + bool isItemSelected() + { return (mItemSelected) ? true : false; } + + /** + * Remove a item from the shortcut. + */ + void removeItem(int index) + { mItems[index] = NULL; } + + /** + * Try to use the item specified by the index. + * + * @param index Index of the item shortcut. + */ + void useItem(int index); + + private: + /** + * Save the configuration information. + */ + void save(); + + ItemPtr mItems[SHORTCUT_ITEMS]; /**< the items stored */ + ItemPtr mItemSelected; /**< the item held by cursor */ + +}; + +extern ItemShortcut *itemShortcut; + +#endif diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp new file mode 100644 index 00000000..271961c8 --- /dev/null +++ b/src/keyboardconfig.cpp @@ -0,0 +1,144 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#include "keyboardconfig.h" +#include "configuration.h" +#include "log.h" + +#include + +#include "gui/setup_keyboard.h" + +struct KeyData +{ + const char *configField; + int defaultValue; + const char *caption; +}; + +// keyData must be in same order as enum keyAction. +static KeyData const keyData[KeyboardConfig::KEY_TOTAL] = { + {"keyMoveUp", SDLK_UP, "Move Up"}, + {"keyMoveDown", SDLK_DOWN, "Move Down"}, + {"keyMoveLeft", SDLK_LEFT, "Move Left"}, + {"keyMoveRight", SDLK_RIGHT, "Move Right"}, + {"keyAttack", SDLK_LCTRL, "Attack"}, + {"keyTarget", SDLK_LSHIFT, "Target"}, + {"keyTargetClosest", SDLK_a, "Target Closest"}, + {"keyPickup", SDLK_z, "Pickup"}, + {"keyHideWindows", SDLK_h, "Hide Windows"}, + {"keyBeingSit", SDLK_s, "Sit"}, + {"keyShortcut0", SDLK_0, "Item Shortcut 0"}, + {"keyShortcut1", SDLK_1, "Item Shortcut 1"}, + {"keyShortcut2", SDLK_2, "Item Shortcut 2"}, + {"keyShortcut3", SDLK_3, "Item Shortcut 3"}, + {"keyShortcut4", SDLK_4, "Item Shortcut 4"}, + {"keyShortcut5", SDLK_5, "Item Shortcut 5"}, + {"keyShortcut6", SDLK_6, "Item Shortcut 6"}, + {"keyShortcut7", SDLK_7, "Item Shortcut 7"}, + {"keyShortcut8", SDLK_8, "Item Shortcut 8"}, + {"keyShortcut9", SDLK_9, "Item Shortcut 9"} +}; + +void KeyboardConfig::init() +{ + for (int i = 0; i < KEY_TOTAL; i++) + { + mKey[i].configField = keyData[i].configField; + mKey[i].defaultValue = keyData[i].defaultValue; + mKey[i].caption = keyData[i].caption; + mKey[i].value = KEY_NO_VALUE; + } + mNewKeyIndex = KEY_NO_VALUE; + mEnabled = true; + + retrieve(); +} + +void KeyboardConfig::retrieve() +{ + for (int i = 0; i < KEY_TOTAL; i++) + { + mKey[i].value = (int) config.getValue( + mKey[i].configField, mKey[i].defaultValue); + } +} + +void KeyboardConfig::store() +{ + for (int i = 0; i < KEY_TOTAL; i++) + { + config.setValue(mKey[i].configField, mKey[i].value); + } +} + +void KeyboardConfig::makeDefault() +{ + for (int i = 0; i < KEY_TOTAL; i++) + { + mKey[i].value = mKey[i].defaultValue; + } +} + +bool KeyboardConfig::hasConflicts() +{ + int i, j; + for (i = 0; i < KEY_TOTAL; i++) + { + for (j = 0; j < KEY_TOTAL; j++) + { + if (i != j && mKey[i].value == mKey[j].value) + { + return true; + } + } + } + return false; +} + +void KeyboardConfig::callbackNewKey() +{ + mSetupKey->newKeyCallback(mNewKeyIndex); +} + +int KeyboardConfig::getKeyIndex(int keyValue) const +{ + for (int i = 0; i < KEY_TOTAL; i++) + { + if(keyValue == mKey[i].value) + { + return i; + } + } + return KEY_NO_VALUE; +} + +bool KeyboardConfig::isKeyActive(int index) +{ + return mActiveKeys[ mKey[index].value]; +} + +void KeyboardConfig::refreshActiveKeys() +{ + mActiveKeys = SDL_GetKeyState(NULL); +} diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h new file mode 100644 index 00000000..46394fa5 --- /dev/null +++ b/src/keyboardconfig.h @@ -0,0 +1,185 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_KEYBOARDCONFIG_H +#define _TMW_KEYBOARDCONFIG_H + +#include + +#include "gui/setup_keyboard.h" + +#include + +/** + * Each key represents a key function. Such as 'Move up', 'Attack' etc. + */ +struct KeyFunction +{ + const char* configField; /** Field index that is in the config file. */ + int defaultValue; /** The default key value used. */ + std::string caption; /** The caption value for the key function. */ + int value; /** The actual value that is used. */ +}; + +class KeyboardConfig +{ + public: + /** + * Initializes the keyboard config explicitly. + */ + void init(); + + /** + * Retrieve the key values from config file. + */ + void retrieve(); + + /** + * Store the key values to config file. + */ + void store(); + + /** + * Make the keys their default values. + */ + void makeDefault(); + + /** + * Determines if any key assignments are the same as each other. + */ + bool hasConflicts(); + + /** + * Calls a function back so the key re-assignment(s) can be seen. + */ + void callbackNewKey(); + + /** + * Obtain the value stored in memory. + */ + int getKeyValue(int index) const + { return mKey[index].value; } + + /** + * Get the index of the new key to be assigned. + */ + int getNewKeyIndex() const + { return mNewKeyIndex; } + + /** + * Get the enable flag, which will stop the user from doing actions. + */ + bool isEnabled() const + { return mEnabled; } + + /** + * Get the key caption, providing more meaning to the user. + */ + const std::string &getKeyCaption(int index) const + { return mKey[index].caption; } + + /** + * Get the key function index by providing the keys value. + */ + int getKeyIndex(int keyValue) const; + + /** + * Set the enable flag, which will stop the user from doing actions. + */ + void setEnabled(bool flag) + { mEnabled = flag; } + + /** + * Set the index of the new key to be assigned. + */ + void setNewKeyIndex(int value) + { mNewKeyIndex = value; } + + /** + * Set the value of the new key. + */ + void setNewKey(int value) + { mKey[mNewKeyIndex].value = value; } + + /** + * Set a reference to the key setup window. + */ + void setSetupKeyboard(Setup_Keyboard *setupKey) + { mSetupKey = setupKey; } + + /** + * Checks if the key is active, by providing the key function index. + */ + bool isKeyActive(int index); + + /** + * Takes a snapshot of all the active keys. + */ + void refreshActiveKeys(); + + /** + * All the key functions. + * KEY_NO_VALUE is used in initialization, and should be unchanged. + * KEY_TOTAL should always be last (used as a conditional in loops). + * The key assignment view gets arranged according to the order of + * these values. + */ + enum KeyAction { + KEY_NO_VALUE = -1, + KEY_MOVE_UP, + KEY_MOVE_DOWN, + KEY_MOVE_LEFT, + KEY_MOVE_RIGHT, + KEY_ATTACK, + KEY_TARGET, + KEY_TARGET_CLOSEST, + KEY_PICKUP, + KEY_HIDE_WINDOWS, + KEY_SIT, + KEY_SHORTCUT_0, + KEY_SHORTCUT_1, + KEY_SHORTCUT_2, + KEY_SHORTCUT_3, + KEY_SHORTCUT_4, + KEY_SHORTCUT_5, + KEY_SHORTCUT_6, + KEY_SHORTCUT_7, + KEY_SHORTCUT_8, + KEY_SHORTCUT_9, + KEY_TOTAL + }; + + private: + int mNewKeyIndex; /**< Index of new key to be assigned */ + bool mEnabled; /**< Flag to respond to key input */ + + Setup_Keyboard *mSetupKey; /**< Reference to setup window */ + + KeyFunction mKey[KEY_TOTAL]; /**< Pointer to all the key data */ + + Uint8 *mActiveKeys; /**< Stores a list of all the keys */ +}; + +extern KeyboardConfig keyboard; + +#endif diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 95e7a478..f4ad7587 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -29,11 +29,19 @@ #include "inventory.h" #include "item.h" #include "main.h" +#include "particle.h" #include "sound.h" #include "log.h" #include "net/gameserver/player.h" +#include "gui/gui.h" + +#include "net/messageout.h" +#include "net/protocol.h" + +#include "utils/tostring.h" + LocalPlayer *player_node = NULL; LocalPlayer::LocalPlayer(): @@ -46,6 +54,7 @@ LocalPlayer::LocalPlayer(): mLevel(1), mMoney(0), mTotalWeight(1), mMaxWeight(1), mHP(1), mMaxHP(1), + mXp(0), mTarget(NULL), mPickUpTarget(NULL), mTrading(false), mLastAction(-1), mWalkingDir(0), @@ -112,6 +121,17 @@ LocalPlayer::moveInvItem(Item *item, int newIndex) item->getInvIndex(), newIndex, item->getQuantity()); } +Item* LocalPlayer::searchForItem(int itemId) +{ + for (int i = 0; i < INVENTORY_SIZE; i++) + { + if (itemId == mInventory->getItem(i)->getId()) { + return mInventory->getItem(i); + } + } + return NULL; +} + void LocalPlayer::equipItem(Item *item) { Net::GameServer::Player::equip(item->getInvIndex()); @@ -302,10 +322,14 @@ void LocalPlayer::attack() setAction(ATTACK); - if (getWeapon() == 2) - sound.playSfx("sfx/bow_shoot_1.ogg"); - else + if (mEquippedWeapon) + { + std::string soundFile = mEquippedWeapon->getSound(EQUIP_EVENT_STRIKE); + if (soundFile != "") sound.playSfx(soundFile); + } + else { sound.playSfx("sfx/fist-swish.ogg"); + } Net::GameServer::Player::attack(getSpriteDirection()); } @@ -329,3 +353,16 @@ void LocalPlayer::raiseAttribute(size_t attr) mAttributeBase.at(attr)++; // TODO: Inform the server about our desire to raise the attribute } + +void LocalPlayer::setXp(int xp) +{ + if (mMap && xp > mXp) + { + const std::string text = toString(xp - mXp) + " xp"; + + // Show XP number + particleEngine->addTextRiseFadeOutEffect(text, hitYellowFont, + mPx + 16, mPy - 16); + } + mXp = xp; +} diff --git a/src/localplayer.h b/src/localplayer.h index 4f38fdad..ff7bf0b7 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -151,6 +151,14 @@ class LocalPlayer : public Player */ void moveInvItem(Item *item, int newIndex); + /** + * Searches for the specified item by it's identification. + * + * @param itemId The id of the item to be searched. + * @return Item found on success, NULL on failure. + */ + Item* searchForItem(int itemId); + /** * Equips an item. */ @@ -237,6 +245,19 @@ class LocalPlayer : public Player int getHP() const { return mHP; } + /** + * Sets the amount of XP. Shows XP gaining effect if the player is on + * a map. + */ + void setXp(int xp); + + /** + * Returns the amount of experience points. + */ + int getXp() const { return mXp; } + + Uint32 mCharId; + int getMaxHP() const { return mMaxHP; } @@ -298,6 +319,7 @@ class LocalPlayer : public Player int mMaxWeight; int mHP; int mMaxHP; + int mXp; /**< Experience points. */ Being *mTarget; FloorItem *mPickUpTarget; diff --git a/src/main.cpp b/src/main.cpp index 1f4eafde..30fb7c1c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,8 +48,10 @@ #endif #include "configuration.h" +#include "keyboardconfig.h" #include "game.h" #include "graphics.h" +#include "itemshortcut.h" #include "lockedarray.h" #include "localplayer.h" #include "log.h" @@ -84,7 +86,6 @@ #include "net/gameserver/gameserver.h" -#include "resources/equipmentdb.h" #include "resources/image.h" #include "resources/itemdb.h" #include "resources/monsterdb.h" @@ -108,6 +109,7 @@ Music *bgm; Configuration config; /**< XML file configuration reader */ Logger *logger; /**< Log object */ +KeyboardConfig keyboard; Net::Connection *accountServerConnection = 0; Net::Connection *gameServerConnection = 0; @@ -189,7 +191,6 @@ void initConfiguration(const Options &options) config.setValue("fpslimit", 0); config.setValue("updatehost", "http://updates.themanaworld.org"); config.setValue("customcursor", 1); - config.setValue("homeDir", homeDir); // Checking if the configuration file exists... otherwise create it with // default options. @@ -319,6 +320,9 @@ void initEngine() // Initialize for drawing graphics->_beginDraw(); + // Initialize the item shortcuts. + itemShortcut = new ItemShortcut(); + gui = new Gui(graphics); state = STATE_CHOOSE_SERVER; /**< Initial game state */ @@ -337,12 +341,19 @@ void initEngine() errorMessage = err; logger->log("Warning: %s", err); } + + // Initialize keyboard + keyboard.init(); } /** Clear the engine */ void exit_engine() { + // Before config.write() since it writes the shortcuts to the config + delete itemShortcut; + config.write(); + delete gui; delete graphics; @@ -353,7 +364,6 @@ void exit_engine() sound.close(); // Unload XML databases - EquipmentDB::unload(); ItemDB::unload(); MonsterDB::unload(); @@ -457,7 +467,6 @@ void loadUpdates() const std::string updatesFile = "updates/resources2.txt"; ResourceManager *resman = ResourceManager::getInstance(); std::vector lines = resman->loadTextFile(updatesFile); - std::string homeDir = config.getValue("homeDir", ""); for (unsigned int i = 0; i < lines.size(); ++i) { @@ -895,7 +904,6 @@ int main(int argc, char *argv[]) false); // Load XML databases - EquipmentDB::load(); ItemDB::load(); MonsterDB::load(); state = STATE_LOGIN; @@ -1039,7 +1047,6 @@ int main(int argc, char *argv[]) } } } - } catch (...) { diff --git a/src/monster.cpp b/src/monster.cpp index 768bf16a..2522a3e1 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -57,7 +57,7 @@ Monster::setAction(Action action) break; case DEAD: currentAction = ACTION_DEAD; - sound.playSfx(getInfo().getSound(EVENT_DIE)); + sound.playSfx(getInfo().getSound(MONSTER_EVENT_DIE)); break; case ATTACK: currentAction = ACTION_ATTACK; @@ -87,10 +87,10 @@ Monster::handleAttack() const MonsterInfo &mi = getInfo(); - // TODO: It's not possible to determine hit or miss here, so this stuff probably needs - // to be moved somewhere else. We may lose synchronization between attack animation and - // the sound, unless we adapt the protocol... - sound.playSfx(mi.getSound(EVENT_HIT)); + // TODO: It's not possible to determine hit or miss here, so this stuff + // probably needs to be moved somewhere else. We may lose synchronization + // between attack animation and the sound, unless we adapt the protocol... + sound.playSfx(mi.getSound(MONSTER_EVENT_HIT)); } Being::TargetCursorSize diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index 87972212..b88d443e 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -114,7 +114,7 @@ void BeingHandler::handleMessage(MessageIn &msg) dstBeing = beingManager->findBeing(id); - if (dstBeing == NULL) + if (!dstBeing) { // Being with id >= 110000000 and job 0 are better // known as ghosts, so don't create those. @@ -138,30 +138,32 @@ void BeingHandler::handleMessage(MessageIn &msg) dstBeing->setWalkSpeed(speed); dstBeing->mJob = job; - dstBeing->setHairStyle(msg.readShort()); - dstBeing->setWeapon(msg.readShort()); + dstBeing->setHairStyle(msg->readShort()); + dstBeing->setVisibleEquipment( + Being::WEAPON_SPRITE, msg->readShort()); dstBeing->setVisibleEquipment( - Being::BOTTOMCLOTHES_SPRITE, msg.readShort()); + Being::BOTTOMCLOTHES_SPRITE, msg->readShort()); if (msg.getId() == SMSG_BEING_MOVE) { msg.readLong(); // server tick } - msg.readShort(); // shield - dstBeing->setVisibleEquipment(Being::HAIT_SPRITE, msg.readShort()); - dstBeing->setVisibleEquipment( - Being::TOPCLOTHES_SPRITE, msg.readShort()); - dstBeing->setHairColor(msg.readShort()); - msg.readShort(); // unknown - msg.readShort(); // head dir - msg.readShort(); // guild - msg.readShort(); // unknown - msg.readShort(); // unknown - msg.readShort(); // manner - msg.readShort(); // karma - msg.readByte(); // unknown - dstBeing->setSex(1 - msg.readByte()); // sex + msg->readShort(); // shield + headTop = msg->readShort(); + headMid = msg->readShort(); + dstBeing->setVisibleEquipment(Being::HAT_SPRITE, headTop); + dstBeing->setVisibleEquipment(Being::TOPCLOTHES_SPRITE, headMid); + dstBeing->setHairColor(msg->readShort()); + msg->readShort(); // unknown + msg->readShort(); // head dir + msg->readShort(); // guild + msg->readShort(); // unknown + msg->readShort(); // unknown + msg->readShort(); // manner + msg->readShort(); // karma + msg->readByte(); // unknown + dstBeing->setSex(1 - msg->readByte()); // sex if (msg.getId() == SMSG_BEING_MOVE) { @@ -256,10 +258,12 @@ void BeingHandler::handleMessage(MessageIn &msg) } Particle *levelupFX; if (msg->readLong() == 0) { // type - levelupFX = particleEngine->addEffect("graphics/particles/levelup.particle.xml", 0, 0); + levelupFX = particleEngine->addEffect( + "graphics/particles/levelup.particle.xml", 0, 0); } else { - levelupFX = particleEngine->addEffect("graphics/particles/skillup.particle.xml", 0, 0); + levelupFX = particleEngine->addEffect( + "graphics/particles/skillup.particle.xml", 0, 0); } beingManager->findBeing(id)->controlParticle(levelupFX); break; @@ -289,28 +293,26 @@ void BeingHandler::handleMessage(MessageIn &msg) dstBeing->setHairStyle(id); break; case 2: - dstBeing->setWeapon(id); + dstBeing->setVisibleEquipment(Being::WEAPON_SPRITE, id); break; case 3: // Change lower headgear for eAthena, pants for us dstBeing->setVisibleEquipment( - Being::BOTTOMCLOTHES_SPRITE, - id); + Being::BOTTOMCLOTHES_SPRITE, id); break; case 4: // Change upper headgear for eAthena, hat for us dstBeing->setVisibleEquipment( - Being::HAT_SPRITE, - id); + Being::HAT_SPRITE, id); break; case 5: // Change middle headgear for eathena, armor for us dstBeing->setVisibleEquipment( - Being::TOPCLOTHES_SPRITE, - id); + Being::TOPCLOTHES_SPRITE, id); break; case 6: dstBeing->setHairColor(id); break; default: - logger->log("c3: %i\n", id); // unsupported + logger->log("SMSG_BEING_CHANGE_LOOKS: unsupported type: " + "%d, id: %d", type, id); break; } } @@ -336,17 +338,18 @@ void BeingHandler::handleMessage(MessageIn &msg) dstBeing = beingManager->findBeing(id); - if (dstBeing == NULL) + if (!dstBeing) { dstBeing = beingManager->createBeing(id, job); } dstBeing->setWalkSpeed(speed); dstBeing->mJob = job; - dstBeing->setHairStyle(msg.readShort()); - dstBeing->setWeaponById(msg.readShort()); // item id 1 - msg.readShort(); // item id 2 - headBottom = msg.readShort(); + dstBeing->setHairStyle(msg->readShort()); + dstBeing->setVisibleEquipment( + Being::WEAPON_SPRITE, msg->readShort()); + msg->readShort(); // item id 2 + headBottom = msg->readShort(); if (msg.getId() == SMSG_PLAYER_MOVE) { @@ -407,9 +410,9 @@ void BeingHandler::handleMessage(MessageIn &msg) case 0x0119: // Change in players look - logger->log("0x0119 %li %i %i %x %i\n", msg.readLong(), - msg.readShort(), msg.readShort(), msg.readShort(), - msg.readByte()); + logger->log("0x0119 %i %i %i %x %i", msg->readLong(), + msg->readShort(), msg->readShort(), msg->readShort(), + msg->readByte()); break; */ } @@ -428,11 +431,9 @@ static void handleLooks(Being *being, MessageIn &msg) if (mask & (1 << 7)) { // The equipment has to be cleared first. - being->setWeaponById(0); for (int i = 0; i < nb_slots; ++i) { - if (slots[i] != Being::WEAPON_SPRITE) - being->setVisibleEquipment(slots[i], 0); + being->setVisibleEquipment(slots[i], 0); } } @@ -441,10 +442,7 @@ static void handleLooks(Being *being, MessageIn &msg) { if (!(mask & (1 << i))) continue; int id = msg.readShort(); - if (slots[i] != Being::WEAPON_SPRITE) - being->setVisibleEquipment(slots[i], id); - else - being->setWeaponById(id); + being->setVisibleEquipment(slots[i], id); } } diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp index 3efe3174..afdc2ab5 100644 --- a/src/net/chathandler.cpp +++ b/src/net/chathandler.cpp @@ -37,6 +37,7 @@ #include "../gui/chat.h" #include "../utils/tostring.h" +#include "../utils/trim.h" extern Being *player_node; @@ -167,6 +168,7 @@ void ChatHandler::handleMessage(MessageIn &msg) chatMsg = msg.readString(chatMsgLength); chatWindow->chatLog(chatMsg, BY_OTHER); chatMsg.erase(0, chatMsg.find(" : ", 0) + 3); + trim(chatMsg); being->setSpeech(chatMsg, SPEECH_TIME); break; diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp index 354dd685..de74e8f5 100644 --- a/src/net/inventoryhandler.cpp +++ b/src/net/inventoryhandler.cpp @@ -31,6 +31,7 @@ #include "../equipment.h" #include "../inventory.h" #include "../item.h" +#include "../itemshortcut.h" #include "../localplayer.h" #include "../gui/chat.h" @@ -77,6 +78,7 @@ void InventoryHandler::handleMessage(MessageIn &msg) it->setQuantity(amount); } }; + itemShortcut->load(); break; } } diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp index b94b5128..afaeca69 100644 --- a/src/net/playerhandler.cpp +++ b/src/net/playerhandler.cpp @@ -133,7 +133,8 @@ void PlayerHandler::handleMessage(MessageIn &msg) } else { - logger->log("Warning: server wants to update unknown attribute %d to %d", stat, value); + logger->log("Warning: server wants to update unknown " + "attribute %d to %d", stat, value); } } } break; diff --git a/src/particle.cpp b/src/particle.cpp index 805da102..148bbf6f 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -52,14 +52,12 @@ const float Particle::PARTICLE_SKY = 800.0f; Particle::Particle(Map *map): mAlive(true), - mPosX(0.0f), mPosY(0.0f), mPosZ(0.0f), mLifetimeLeft(-1), mLifetimePast(0), mFadeOut(0), mFadeIn(0), mAutoDelete(true), mMap(map), - mVectorX(0.0f), mVectorY(0.0f), mVectorZ(0.0f), mGravity(0.0f), mRandomnes(0), mBounce(0.0f), @@ -109,7 +107,7 @@ Particle::update() p++ ) { - (*p)->moveBy(mPosX, mPosY, mPosZ); + (*p)->moveBy(mPos.x, mPos.y, mPos.z); mChildParticles.push_back (*p); } } @@ -117,31 +115,28 @@ Particle::update() if (mMomentum != 1.0f) { - mVectorX *= mMomentum; - mVectorY *= mMomentum; - mVectorZ *= mMomentum; + mVelocity *= mMomentum; } if (mTarget && mAcceleration != 0.0f) { - float distX = (mPosX - mTarget->getPosX()) * SIN45; - float distY = mPosY - mTarget->getPosY(); - float distZ = mPosZ - mTarget->getPosZ(); + Vector dist = mPos - mTarget->getPosition(); + dist.x *= SIN45; float invHypotenuse; - switch(Particle::fastPhysics) + switch (Particle::fastPhysics) { case 1: invHypotenuse = fastInvSqrt( - distX * distX + distY * distY + distZ * distZ); + dist.x * dist.x + dist.y * dist.y + dist.z * dist.z); break; case 2: invHypotenuse = 2.0f / - fabs(distX) + fabs(distY) + fabs(distZ); + fabs(dist.x) + fabs(dist.y) + fabs(dist.z); break; default: invHypotenuse = 1.0f / sqrt( - distX * distX + distY * distY + distZ * distZ); + dist.x * dist.x + dist.y * dist.y + dist.z * dist.z); break; } @@ -152,25 +147,23 @@ Particle::update() mAlive = false; } float accFactor = invHypotenuse * mAcceleration; - mVectorX -= distX * accFactor; - mVectorY -= distY * accFactor; - mVectorZ -= distZ * accFactor; + mVelocity -= dist * accFactor; } } if (mRandomnes > 0) { - mVectorX += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; - mVectorY += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; - mVectorZ += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; + mVelocity.x += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; + mVelocity.y += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; + mVelocity.z += (rand()%mRandomnes - rand()%mRandomnes) / 1000.0f; } - mVectorZ -= mGravity; + mVelocity.z -= mGravity; // Update position - mPosX += mVectorX; - mPosY += mVectorY * SIN45; - mPosZ += mVectorZ * SIN45; + mPos.x += mVelocity.x; + mPos.y += mVelocity.y * SIN45; + mPos.z += mVelocity.z * SIN45; // Update other stuff if (mLifetimeLeft > 0) @@ -179,14 +172,13 @@ Particle::update() } mLifetimePast++; - if (mPosZ > PARTICLE_SKY || mPosZ < 0.0f) + if (mPos.z > PARTICLE_SKY || mPos.z < 0.0f) { if (mBounce > 0.0f) { - mPosZ *= -mBounce; - mVectorX *= mBounce; - mVectorY *= mBounce; - mVectorZ *= -mBounce; + mPos.z *= -mBounce; + mVelocity *= mBounce; + mVelocity.z = -mVelocity.z; } else { mAlive = false; @@ -195,10 +187,8 @@ Particle::update() } // Update child particles - for ( ParticleIterator p = mChildParticles.begin(); - p != mChildParticles.end(); - - ) + for (ParticleIterator p = mChildParticles.begin(); + p != mChildParticles.end();) { if ((*p)->update()) { @@ -217,14 +207,9 @@ Particle::update() return true; } - -void Particle::draw(Graphics *graphics, int offsetX, int offsetY) const -{ -} - - Particle* -Particle::addEffect(std::string particleEffectFile, int pixelX, int pixelY) +Particle::addEffect(const std::string &particleEffectFile, + int pixelX, int pixelY) { Particle *newParticle = NULL; @@ -289,9 +274,9 @@ Particle::addEffect(std::string particleEffectFile, int pixelX, int pixelY) int offsetY = XML::getProperty(effectChildNode, "position-y", 0); int offsetZ = XML::getProperty(effectChildNode, "position-z", 0); - int particleX = (int)mPosX + pixelX + offsetX; - int particleY = (int)mPosY + pixelY + offsetY; - int particleZ = (int)mPosZ + offsetZ; + int particleX = (int) mPos.x + pixelX + offsetX; + int particleY = (int) mPos.y + pixelY + offsetY; + int particleZ = (int) mPos.z + offsetZ; int lifetime = XML::getProperty(effectChildNode, "lifetime", -1); @@ -317,17 +302,16 @@ Particle::addEffect(std::string particleEffectFile, int pixelX, int pixelY) Particle* -Particle::addTextSplashEffect(std::string text, +Particle::addTextSplashEffect(const std::string &text, int colorR, int colorG, int colorB, gcn::Font *font, int x, int y) { Particle *newParticle = new TextParticle(mMap, text, colorR, colorG, colorB, font); newParticle->setPosition(x, y, 0); - newParticle->setVector ( ((rand()%100) - 50) / 200.0f, // X vector - ((rand()%100) - 50) / 200.0f, // Y vector - ((rand()%100) / 200.0f) + 4.0f // Z vector - ); + newParticle->setVelocity(((rand() % 100) - 50) / 200.0f, // X + ((rand() % 100) - 50) / 200.0f, // Y + ((rand() % 100) / 200.0f) + 4.0f); // Z newParticle->setGravity(0.1f); newParticle->setBounce(0.5f); newParticle->setLifetime(200); @@ -338,14 +322,28 @@ Particle::addTextSplashEffect(std::string text, return newParticle; } +Particle* +Particle::addTextRiseFadeOutEffect(const std::string &text, gcn::Font *font, + int x, int y) +{ + Particle *newParticle = new TextParticle(mMap, text, 255, 255, 255, font); + newParticle->setPosition(x, y, 0); + newParticle->setVelocity(0.0f, 0.0f, 0.5f); + newParticle->setGravity(0.0015f); + newParticle->setLifetime(300); + newParticle->setFadeOut(50); + newParticle->setFadeIn(200); + + mChildParticles.push_back(newParticle); + + return newParticle; +} void Particle::setMap(Map *map) { mMap = map; if (mMap) setSpriteIterator(mMap->addSprite(this)); - - // TODO: Create map emitters based on emitter data in map data } diff --git a/src/particle.h b/src/particle.h index 9e9223c7..dd7c5ee2 100644 --- a/src/particle.h +++ b/src/particle.h @@ -31,7 +31,7 @@ #include "guichanfwd.h" #include "sprite.h" - +#include "vector.h" class Map; class Particle; @@ -67,43 +67,37 @@ class Particle : public Sprite ~Particle(); /** - * Deletes all child particles and emitters + * Deletes all child particles and emitters. */ void clear(); /** * Gives a particle the properties of an engine root particle and loads - * the particle-related config settings + * the particle-related config settings. */ void setupEngine(); /** * Updates particle position, returns false when the particle should - * be deleted + * be deleted. */ virtual bool update(); /** - * Draws the particle image + * Draws the particle image. */ virtual void - draw(Graphics *graphics, int offsetX, int offsetY) const; + draw(Graphics *graphics, int offsetX, int offsetY) const {} /** - * Necessary for sorting with the other sprites + * Necessary for sorting with the other sprites. */ virtual int getPixelY() const - { - return (int)(mPosY + mPosZ) - 64; - }; - - /* - Basic Particle properties: - */ + { return (int) (mPos.y + mPos.z) - 64; } /** * Sets the map the particle is on. @@ -115,15 +109,24 @@ class Particle : public Sprite * particleEffectFile. */ Particle* - addEffect(std::string particleEffectFile, int pixelX, int pixelY); + addEffect(const std::string &particleEffectFile, + int pixelX, int pixelY); /** * Creates a standalone text particle. */ Particle* - addTextSplashEffect(std::string text, int colorR, int colorG, int colorB, + addTextSplashEffect(const std::string &text, + int colorR, int colorG, int colorB, gcn::Font *font, int x, int y); + /** + * Creates a standalone text particle. + */ + Particle* + addTextRiseFadeOutEffect(const std::string &text, gcn::Font *font, + int x, int y); + /** * Adds an emitter to the particle. */ @@ -132,34 +135,31 @@ class Particle : public Sprite { mChildEmitters.push_back(emitter); } /** - * Sets the position in 3 dimensional space in pixels relative to map + * Sets the position in 3 dimensional space in pixels relative to map. */ void setPosition(float x, float y, float z) - { mPosX = x; mPosY = y; mPosZ = z; } + { mPos.x = x; mPos.y = y; mPos.z = z; } /** - * Sets the position in 2 dimensional space in pixels relative to map + * Sets the position in 2 dimensional space in pixels relative to map. */ void setPosition(float x, float y) - { mPosX = x; mPosY = y; } - - float getPosX() const - { return mPosX; } + { mPos.x = x; mPos.y = y; } - float getPosY() const - { return mPosY; } - - float getPosZ() const - { return mPosZ; } + /** + * Returns the particle position. + */ + const Vector& getPosition() const + { return mPos; } /** * Changes the particle position relative */ void moveBy(float x, float y, float z) - { mPosX += x; mPosY += y; mPosZ += z; } + { mPos.x += x; mPos.y += y; mPos.z += z; } /** * Sets the time in game ticks until the particle is destroyed. @@ -170,48 +170,48 @@ class Particle : public Sprite /** * Sets the age of the pixel in game ticks where the particle has - * faded in completely + * faded in completely. */ void - setFadeOut (int fadeOut) + setFadeOut(int fadeOut) { mFadeOut = fadeOut; } /** * Sets the remaining particle lifetime where the particle starts to - * fade out + * fade out. */ void - setFadeIn (int fadeIn) + setFadeIn(int fadeIn) { mFadeIn = fadeIn; } /** * Sets the sprite iterator of the particle on the current map to make - * it easier to remove the particle from the map when it is destroyed + * it easier to remove the particle from the map when it is destroyed. */ void setSpriteIterator(std::list::iterator spriteIterator) { mSpriteIterator = spriteIterator; } /** - * Gets the sprite iterator of the particle on the current map + * Gets the sprite iterator of the particle on the current map. */ std::list::iterator getSpriteIterator() const { return mSpriteIterator; } /** - * Sets the current velocity in 3 dimensional space + * Sets the current velocity in 3 dimensional space. */ void - setVector(float x, float y, float z) - { mVectorX = x; mVectorY = y; mVectorZ = z; } + setVelocity(float x, float y, float z) + { mVelocity.x = x; mVelocity.y = y; mVelocity.z = z; } /** - * Sets the downward acceleration + * Sets the downward acceleration. */ void - setGravity(float g) - { mGravity = g; } + setGravity(float gravity) + { mGravity = gravity; } /** * Sets the ammount of random vector changes @@ -237,8 +237,8 @@ class Particle : public Sprite /** * Sets the distance in pixel the particle can come near the target - * particle before it is destroyed. Does only make sense after a - * target particle has been set using setDestination. + * particle before it is destroyed. Does only make sense after a target + * particle has been set using setDestination. */ void setDieDistance(float dist) { mInvDieDistance = 1.0f / dist; } @@ -247,7 +247,7 @@ class Particle : public Sprite { return mAlive; } /** - * Manually marks the particle for deletion + * Manually marks the particle for deletion. */ void kill() { mAlive = false; mAutoDelete = true; } @@ -261,7 +261,7 @@ class Particle : public Sprite protected: bool mAlive; /**< Is the particle supposed to be drawn and updated?*/ - float mPosX, mPosY, mPosZ; /**< Position in 3 dimensonal space - pixel based relative to map */ + Vector mPos; /**< Position in pixels relative to map. */ int mLifetimeLeft; /**< Lifetime left in game ticks*/ int mLifetimePast; /**< Age of the particle in game ticks*/ int mFadeOut; /**< Lifetime in game ticks left where fading out begins*/ @@ -269,17 +269,19 @@ class Particle : public Sprite private: // generic properties - bool mAutoDelete; /**< May the particle request its deletion by the parent particle?*/ - Map *mMap; /**< Map the particle is on*/ + bool mAutoDelete; /**< May the particle request its deletion by the parent particle? */ + Map *mMap; /**< Map the particle is on. */ std::list::iterator mSpriteIterator; /**< iterator of the particle on the current map */ - Emitters mChildEmitters; /**< List of child emitters*/ - Particles mChildParticles; /**< List of particles controlled by this particle*/ - //dynamic particle - float mVectorX, mVectorY, mVectorZ; /**< Speed in 3 dimensional space in pixels per game-tick */ - float mGravity; /**< Downward acceleration in pixels per game-tick²*/ - int mRandomnes; /**< Ammount of random vector change*/ - float mBounce; /**< How much the particle bounces off when hitting the ground*/ - //follow-point particles + Emitters mChildEmitters; /**< List of child emitters. */ + Particles mChildParticles; /**< List of particles controlled by this particle */ + + // dynamic particle + Vector mVelocity; /**< Speed in pixels per game-tick. */ + float mGravity; /**< Downward acceleration in pixels per game-tick. */ + int mRandomnes; /**< Ammount of random vector change */ + float mBounce; /**< How much the particle bounces off when hitting the ground */ + + // follow-point particles Particle *mTarget; /**< The particle that attracts this particle*/ float mAcceleration; /**< Acceleration towards the target particle in pixels per game-tick²*/ float mInvDieDistance; /**< Distance in pixels from the target particle that causes the destruction of the particle*/ diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index 60a98cc5..035882b6 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -248,10 +248,9 @@ ParticleEmitter::readMinMax(xmlNodePtr propertyNode, T def) { MinMax retval; - def = (T)XML::getFloatProperty(propertyNode, "value", (double)def); - retval.set ( (T)XML::getFloatProperty(propertyNode, "min", (double)def), - (T)XML::getFloatProperty(propertyNode, "max", (double)def) - ); + def = (T) XML::getFloatProperty(propertyNode, "value", (double) def); + retval.set((T) XML::getFloatProperty(propertyNode, "min", (double) def), + (T) XML::getFloatProperty(propertyNode, "max", (double) def)); return retval; } @@ -284,19 +283,17 @@ ParticleEmitter::createParticles() newParticle->setPosition( - mParticlePosX.value(), - mParticlePosY.value(), - mParticlePosZ.value() - ); + mParticlePosX.value(), + mParticlePosY.value(), + mParticlePosZ.value()); float angleH = mParticleAngleHorizontal.value(); float angleV = mParticleAngleVertical.value(); float power = mParticlePower.value(); - newParticle->setVector( - cos(angleH) * cos(angleV) * power, - sin(angleH) * cos(angleV) * power, - sin(angleV) * power - ); + newParticle->setVelocity( + cos(angleH) * cos(angleV) * power, + sin(angleH) * cos(angleV) * power, + sin(angleV) * power); newParticle->setRandomnes(mParticleRandomnes.value()); newParticle->setGravity(mParticleGravity.value()); @@ -312,10 +309,9 @@ ParticleEmitter::createParticles() newParticle->setFadeOut(mParticleFadeOut.value()); newParticle->setFadeIn(mParticleFadeIn.value()); - for ( std::list::iterator i = mParticleChildEmitters.begin(); - i != mParticleChildEmitters.end(); - i++ - ) + for (std::list::iterator i = mParticleChildEmitters.begin(); + i != mParticleChildEmitters.end(); + i++) { newParticle->addEmitter(new ParticleEmitter(*i)); } diff --git a/src/player.cpp b/src/player.cpp index d3c27aa0..b63dcd5b 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -28,7 +28,8 @@ #include "graphics.h" #include "log.h" -#include "resources/equipmentdb.h" +#include "resources/itemdb.h" +#include "resources/iteminfo.h" #include "utils/tostring.h" @@ -37,7 +38,6 @@ Player::Player(Uint16 id, Uint16 job, Map *map): Being(id, job, map) { - setWeapon(0); } Being::Type @@ -93,8 +93,8 @@ Player::setSex(Uint8 sex) if (i != HAIR_SPRITE && mEquipmentSpriteIDs.at(i) != 0) { AnimatedSprite *newEqSprite = new AnimatedSprite( - "graphics/sprites/" + EquipmentDB::get( - mEquipmentSpriteIDs.at(i))->getSprite(sex)); + "graphics/sprites/" + ItemDB::get( + mEquipmentSpriteIDs.at(i)).getSprite(sex)); delete mSprites[i]; mSprites[i] = newEqSprite; } @@ -102,39 +102,6 @@ Player::setSex(Uint8 sex) } } -void -Player::setWeapon(Uint16 weapon) -{ - if (weapon != mWeapon) - { - AnimatedSprite *newWeaponSprite = NULL; - - switch (weapon) - { - case 0: - newWeaponSprite = - new AnimatedSprite("graphics/sprites/weapon-fist.xml"); - break; - case 1: - newWeaponSprite = - new AnimatedSprite("graphics/sprites/weapon-dagger.xml"); - break; - case 2: - newWeaponSprite = - new AnimatedSprite("graphics/sprites/weapon-bow.xml"); - break; - case 3: - newWeaponSprite = - new AnimatedSprite("graphics/sprites/weapon-scythe.xml"); - break; - } - - delete mSprites[WEAPON_SPRITE]; - mSprites[WEAPON_SPRITE] = newWeaponSprite; - } - Being::setWeapon(weapon); -} - void Player::setHairColor(Uint16 color) { @@ -189,11 +156,11 @@ Player::setVisibleEquipment(Uint8 slot, int id) if (mSex == 0) { equipmentSprite = new AnimatedSprite( - "graphics/sprites/" + EquipmentDB::get(id)->getSprite(0)); + "graphics/sprites/" + ItemDB::get(id).getSprite(0)); } else { equipmentSprite = new AnimatedSprite( - "graphics/sprites/" + EquipmentDB::get(id)->getSprite(1)); + "graphics/sprites/" + ItemDB::get(id).getSprite(1)); } equipmentSprite->setDirection(getSpriteDirection()); @@ -201,6 +168,11 @@ Player::setVisibleEquipment(Uint8 slot, int id) delete mSprites[slot]; mSprites[slot] = equipmentSprite; + if (slot == WEAPON_SPRITE) + { + mEquippedWeapon = &ItemDB::get(id); + } + setAction(mAction); } diff --git a/src/player.h b/src/player.h index 8aa84992..2c06bfba 100644 --- a/src/player.h +++ b/src/player.h @@ -59,9 +59,6 @@ class Player : public Being virtual void setVisibleEquipment(Uint8 slot, int id); - - virtual void - setWeapon(Uint16 weapon); }; #endif diff --git a/src/resources/equipmentdb.cpp b/src/resources/equipmentdb.cpp deleted file mode 100644 index 38ac6415..00000000 --- a/src/resources/equipmentdb.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* - * The Mana World - * Copyright 2006 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#include "equipmentdb.h" - -#include "resourcemanager.h" - -#include "../log.h" - -#include "../utils/dtor.h" -#include "../utils/xml.h" - -namespace -{ - EquipmentDB::EquipmentInfos mEquipmentInfos; - EquipmentInfo mUnknown; - bool mLoaded = false; -} - -void -EquipmentDB::load() -{ - if (mLoaded) - return; - - logger->log("Initializing equipment database..."); - mUnknown.setSprite("error.xml", 0); - mUnknown.setSprite("error.xml", 1); - - ResourceManager *resman = ResourceManager::getInstance(); - int size; - char *data = (char*)resman->loadFile("equipment.xml", size); - - if (!data) - { - logger->error("Equipment Database: Could not find equipment.xml!"); - } - - xmlDocPtr doc = xmlParseMemory(data, size); - free(data); - - if (!doc) - { - logger->error("Equipment Database: Error while parsing equipment database (equipment.xml)!"); - } - - xmlNodePtr rootNode = xmlDocGetRootElement(doc); - if (!rootNode || !xmlStrEqual(rootNode->name, BAD_CAST "equipments")) - { - logger->error("Equipment Database: equipment.xml is not a valid database file!"); - } - - //iterate s - for_each_xml_child_node(equipmentNode, rootNode) - { - if (!xmlStrEqual(equipmentNode->name, BAD_CAST "equipment")) - { - continue; - } - - EquipmentInfo *currentInfo = new EquipmentInfo(); - - currentInfo->setSlot (XML::getProperty(equipmentNode, "slot", 0)); - - //iterate s - for_each_xml_child_node(spriteNode, equipmentNode) - { - if (!xmlStrEqual(spriteNode->name, BAD_CAST "sprite")) - { - continue; - } - - std::string gender = XML::getProperty(spriteNode, "gender", "unisex"); - std::string filename = (const char*) spriteNode->xmlChildrenNode->content; - - if (gender == "male" || gender == "unisex") - { - currentInfo->setSprite(filename, 0); - } - - if (gender == "female" || gender == "unisex") - { - currentInfo->setSprite(filename, 1); - } - } - - setEquipment( XML::getProperty(equipmentNode, "id", 0), - currentInfo); - } - - mLoaded = true; -} - -void -EquipmentDB::unload() -{ - // kill EquipmentInfos - for_each ( mEquipmentInfos.begin(), mEquipmentInfos.end(), - make_dtor(mEquipmentInfos)); - mEquipmentInfos.clear(); - - mLoaded = false; -} - -EquipmentInfo* -EquipmentDB::get(int id) -{ - if (!mLoaded) { - logger->error("Error: Equipment database used before initialization!"); - } - - EquipmentInfoIterator i = mEquipmentInfos.find(id); - - if (i == mEquipmentInfos.end() ) - { - logger->log("EquipmentDB: Error, unknown equipment ID# %d", id); - return &mUnknown; - } - else - { - return i->second; - } -} - -void -EquipmentDB::setEquipment(int id, EquipmentInfo* equipmentInfo) -{ - if (mEquipmentInfos.find(id) != mEquipmentInfos.end()) { - logger->log("Warning: Equipment Piece with ID %d defined multiple times", - id); - delete equipmentInfo; - } - else { - mEquipmentInfos[id] = equipmentInfo; - }; -} diff --git a/src/resources/equipmentdb.h b/src/resources/equipmentdb.h deleted file mode 100644 index 1c1db7d1..00000000 --- a/src/resources/equipmentdb.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * The Mana World - * Copyright 2006 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#ifndef _TMW_EQUIPMENT_DB_H -#define _TMW_EQUIPMENT_DB_H - -#include - -#include "equipmentinfo.h" - -/** - * Equipment information database. - */ -namespace EquipmentDB -{ - /** - * Loads the equipment info from Items.xml - */ - void load(); - - /** - * Frees equipment data - */ - void unload(); - - void setEquipment(int id, EquipmentInfo* equipmentInfo); - - EquipmentInfo* get(int id); - - // Equipment database types - typedef std::map EquipmentInfos; - typedef EquipmentInfos::iterator EquipmentInfoIterator; -} - -#endif diff --git a/src/resources/equipmentinfo.h b/src/resources/equipmentinfo.h deleted file mode 100644 index 75ed1b8a..00000000 --- a/src/resources/equipmentinfo.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The Mana World - * Copyright 2006 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id: - */ - -#ifndef _TMW_EQUIPMENTINFO_H_ -#define _TMW_EQUIPMENTINFO_H_ - -#include -#include - -class EquipmentInfo -{ - public: - EquipmentInfo(): - mSlot (0) - { - }; - - void - setSlot (int slot) { mSlot = slot; }; - - const std::string& - getSprite(int gender) {return animationFiles[gender]; }; - - void - setSprite(std::string animationFile, int gender) {animationFiles[gender] = animationFile; }; - - private: - int mSlot; //not used at the moment but maybe useful on our own server - std::map animationFiles; -}; - -#endif diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 7b16339c..18952ae9 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -18,9 +18,11 @@ * 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: + * $Id$ */ +#include + #include "itemdb.h" #include @@ -36,10 +38,13 @@ namespace { ItemDB::ItemInfos mItemInfos; - ItemInfo mUnknown; + ItemInfo *mUnknown; bool mLoaded = false; } +// Forward declarations +static void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node); +static void loadSoundRef(ItemInfo *itemInfo, xmlNodePtr node); void ItemDB::load() { @@ -47,11 +52,16 @@ void ItemDB::load() return; logger->log("Initializing item database..."); - mUnknown.setName("Unknown item"); + + mUnknown = new ItemInfo(); + mUnknown->setName("Unknown item"); + mUnknown->setImage(""); + mUnknown->setSprite("error.xml", 0); + mUnknown->setSprite("error.xml", 1); ResourceManager *resman = ResourceManager::getInstance(); int size; - char *data = (char*)resman->loadFile("items.xml", size); + char *data = (char*) resman->loadFile("items.xml", size); if (!data) { logger->error("ItemDB: Could not find items.xml!"); @@ -73,48 +83,66 @@ void ItemDB::load() for_each_xml_child_node(node, rootNode) { - if (!xmlStrEqual(node->name, BAD_CAST "item")) { + if (!xmlStrEqual(node->name, BAD_CAST "item")) continue; - } int id = XML::getProperty(node, "id", 0); - int art = XML::getProperty(node, "art", 0); + + if (id == 0) + { + 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); + } + int type = XML::getProperty(node, "type", 0); int weight = XML::getProperty(node, "weight", 0); + int view = XML::getProperty(node, "view", 0); int slot = XML::getProperty(node, "slot", 0); std::string name = XML::getProperty(node, "name", ""); std::string image = XML::getProperty(node, "image", ""); std::string description = XML::getProperty(node, "description", ""); std::string effect = XML::getProperty(node, "effect", ""); + std::string attackType = XML::getProperty(node, "attacktype", ""); - if (id && name != "") + if (id) { ItemInfo *itemInfo = new ItemInfo(); itemInfo->setImage(image); - itemInfo->setArt(art); - itemInfo->setName(name); + itemInfo->setName((name == "") ? "Unnamed" : name); itemInfo->setDescription(description); itemInfo->setEffect(effect); itemInfo->setType(type); + itemInfo->setView(view); itemInfo->setWeight(weight); itemInfo->setSlot(slot); - mItemInfos[id] = itemInfo; - } + itemInfo->setAttackType(attackType); + + for_each_xml_child_node(itemChild, node) + { + if (xmlStrEqual(itemChild->name, BAD_CAST "sprite")) + { + loadSpriteRef(itemInfo, itemChild); + } + else if (xmlStrEqual(itemChild->name, BAD_CAST "sound")) + { + loadSoundRef(itemInfo, itemChild); + } + } - if (id == 0) - { - logger->log("ItemDB: An item has no ID in items.xml!"); + mItemInfos[id] = itemInfo; } #define CHECK_PARAM(param, error_value) \ if (param == error_value) \ - logger->log("ItemDB: Missing" #param " parameter for item %i! %s", \ - id, name.c_str()) + logger->log("ItemDB: Missing " #param " attribute for item %i!",id) CHECK_PARAM(name, ""); CHECK_PARAM(image, ""); - // CHECK_PARAM(art, 0); // CHECK_PARAM(description, ""); // CHECK_PARAM(effect, ""); // CHECK_PARAM(type, 0); @@ -131,19 +159,65 @@ void ItemDB::load() void ItemDB::unload() { - for (ItemInfoIterator i = mItemInfos.begin(); i != mItemInfos.end(); i++) - { - delete i->second; - } - mItemInfos.clear(); + logger->log("Unloading item database..."); + + delete mUnknown; + mUnknown = NULL; + for_each(mItemInfos.begin(), mItemInfos.end(), make_dtor(mItemInfos)); + mItemInfos.clear(); mLoaded = false; } -const ItemInfo& -ItemDB::get(int id) +const ItemInfo& ItemDB::get(int id) { + assert(mLoaded); + ItemInfoIterator i = mItemInfos.find(id); - return (i != mItemInfos.end()) ? *(i->second) : mUnknown; + if (i == mItemInfos.end()) + { + logger->log("ItemDB: Error, unknown item ID# %d", id); + return *mUnknown; + } + else + { + return *(i->second); + } +} + +void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node) +{ + std::string gender = XML::getProperty(node, "gender", "unisex"); + std::string filename = (const char*) node->xmlChildrenNode->content; + + if (gender == "male" || gender == "unisex") + { + itemInfo->setSprite(filename, 0); + } + + if (gender == "female" || gender == "unisex") + { + itemInfo->setSprite(filename, 1); + } +} + +void loadSoundRef(ItemInfo *itemInfo, xmlNodePtr node) +{ + std::string event = XML::getProperty(node, "event", ""); + std::string filename = (const char*) node->xmlChildrenNode->content; + + if (event == "hit") + { + itemInfo->addSound(EQUIP_EVENT_HIT, filename); + } + else if (event == "strike") + { + itemInfo->addSound(EQUIP_EVENT_STRIKE, filename); + } + else + { + logger->log("ItemDB: Ignoring unknown sound event '%s'", + event.c_str()); + } } diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 3a41c657..b5b25ac0 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -25,11 +25,11 @@ #include "resourcemanager.h" #include "image.h" - +#include "itemdb.h" ItemInfo::~ItemInfo() { - if (mImage != NULL) + if (mImage) { mImage->decRef(); } @@ -38,19 +38,87 @@ ItemInfo::~ItemInfo() void ItemInfo::setImage(const std::string &image) { + if (mImage) + { + mImage->decRef(); + } + + ResourceManager *resman = ResourceManager::getInstance(); mImageName = "graphics/items/" + image; + mImage = ResourceManager::getInstance()->getImage(mImageName); - if (mImageName != "") + if (!mImage) { - if (mImage != NULL) - { - mImage->decRef(); - } + mImage = resman->getImage("graphics/gui/unknown-item.png"); + } +} - mImage = ResourceManager::getInstance()->getImage(mImageName); +const std::string& +ItemInfo::getSprite(int gender) const +{ + if (mView) + { + // Forward the request to the item defining how to view this item + return ItemDB::get(mView).getSprite(gender); } else { - mImage = NULL; + static const std::string empty = ""; + std::map::const_iterator i = + mAnimationFiles.find(gender); + + return (i != mAnimationFiles.end()) ? i->second : empty; + } +} + +void +ItemInfo::setAttackType(const std::string &attackType) +{ + if (attackType == "swing") + { + mAttackType = ACTION_ATTACK_SWING; + } + else if (attackType == "stab") + { + mAttackType = ACTION_ATTACK_STAB; + } + else if (attackType == "bow") + { + mAttackType = ACTION_ATTACK_BOW; } + else if (attackType == "throw") + { + mAttackType = ACTION_ATTACK_THROW; + } + else if (attackType == "none") + { + mAttackType = ACTION_DEFAULT; + } + else + { + mAttackType = ACTION_ATTACK; + } +} + +void +ItemInfo::addSound(EquipmentSoundEvent event, const std::string &filename) +{ + if (mSounds.find(event) == mSounds.end()) + { + mSounds[event] = new std::vector; + } + + mSounds[event]->push_back("sfx/" + filename); +} + + +const std::string& +ItemInfo::getSound(EquipmentSoundEvent event) const +{ + static const std::string empty = ""; + std::map*>::const_iterator i; + i = mSounds.find(event); + + return (i == mSounds.end()) ? empty : + i->second->at(rand() % i->second->size()); } diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index e4f851bb..4fd1638e 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -24,12 +24,23 @@ #ifndef _TMW_ITEMINFO_H_ #define _TMW_ITEMINFO_H_ +#include #include +#include + +#include "spritedef.h" class Image; +enum EquipmentSoundEvent +{ + EQUIP_EVENT_STRIKE, + EQUIP_EVENT_HIT +}; + /** - * Defines a class for storing item infos. + * Defines a class for storing item infos. This includes information used when + * the item is equipped. */ class ItemInfo { @@ -40,10 +51,11 @@ class ItemInfo ItemInfo(): mImageName(""), mImage(NULL), - mArt(0), mType(0), mWeight(0), - mSlot(0) + mView(0), + mSlot(0), + mAttackType(ACTION_DEFAULT) { } @@ -52,73 +64,89 @@ class ItemInfo */ ~ItemInfo(); - void - setArt(short art) { mArt = art; } + void setName(const std::string &name) + { mName = name; } - short - getArt() const { return mArt; } + const std::string& getName() const + { return mName; } - void - setName(const std::string &name) { mName = name; } + void setImage(const std::string &image); - const std::string& - getName() const { return mName; } + Image* getImage() const + { return mImage; } - void - setImage(const std::string &image); + void setDescription(const std::string &description) + { mDescription = description; } - Image* - getImage() const { return mImage; } + const std::string& getDescription() const + { return mDescription; } - void - setDescription(const std::string &description) - { - mDescription = description; - } + void setEffect(const std::string &effect) + { mEffect = effect; } const std::string& - getDescription() const { return mDescription; } + getEffect() const { return mEffect; } - void - setEffect(const std::string &effect) { mEffect = effect; } + void setType(short type) + { mType = type; } - const std::string& - getEffect() const { return mEffect; } + short getType() const + { return mType; } + + void setWeight(short weight) + { mWeight = weight; } + + short getWeight() const + { return mWeight; } + + void setView(int view) + { mView = view; } + + void setSlot(char slot) + { mSlot = slot; } - void - setType(short type) { mType = type; } + char getSlot() const + { return mSlot; } - short - getType() const { return mType; } + void setSprite(const std::string &animationFile, int gender) + { mAnimationFiles[gender] = animationFile; } - void - setWeight(short weight) { mWeight = weight; } + const std::string& getSprite(int gender) const; - short - getWeight() const { return mWeight; } + void setAttackType(const std::string &attackType); - void - setSlot(char slot) { mSlot = slot; } + const SpriteAction getAttackType() const + { return mAttackType; } - char - getSlot() const { return mSlot; } + void addSound(EquipmentSoundEvent event, const std::string &filename); + + const std::string& getSound(EquipmentSoundEvent event) const; protected: - std::string mImageName; + std::string mImageName; /**< The filename of the icon image. */ /* TODO (BL): I do not think the item info should keep a reference to * the item icon. It would probably be better if this was kept in the * Item class, so that the images can be lazily instantiated and also * unloaded when no longer used. */ - Image *mImage; - short mArt; + Image *mImage; /**< The loaded icon image. */ std::string mName; - std::string mDescription; - std::string mEffect; - short mType; - short mWeight; - char mSlot; + std::string mDescription; /**< Short description. */ + std::string mEffect; /**< Description of effects. */ + short mType; /**< Item type (never used). */ + short mWeight; /**< Weight in grams. */ + int mView; /**< Item ID of how this item looks. */ + + // Equipment related members + char mSlot; /**< Equipment slot. */ + SpriteAction mAttackType; /**< Attack type, in case of weapon. */ + + /** Maps gender to sprite filenames. */ + std::map mAnimationFiles; + + /** Stores the names of sounds to be played at certain event. */ + std::map* > mSounds; }; #endif diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 260d5aa9..940ded36 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -156,7 +156,7 @@ MapReader::readMap(const std::string &filename) if (buffer == NULL) { - logger->log("Map file not found (%s)\n", filename.c_str()); + logger->log("Map file not found (%s)", filename.c_str()); return NULL; } diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index 339ed6ba..f4864eea 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -120,19 +120,19 @@ MonsterDB::load() if (event == "hit") { - currentInfo->addSound(EVENT_HIT, filename); + currentInfo->addSound(MONSTER_EVENT_HIT, filename); } else if (event == "miss") { - currentInfo->addSound(EVENT_MISS, filename); + currentInfo->addSound(MONSTER_EVENT_MISS, filename); } else if (event == "hurt") { - currentInfo->addSound(EVENT_HURT, filename); + currentInfo->addSound(MONSTER_EVENT_HURT, filename); } else if (event == "die") { - currentInfo->addSound(EVENT_DIE, filename); + currentInfo->addSound(MONSTER_EVENT_DIE, filename); } else { diff --git a/src/resources/monsterinfo.cpp b/src/resources/monsterinfo.cpp index 2a59419e..2e896237 100644 --- a/src/resources/monsterinfo.cpp +++ b/src/resources/monsterinfo.cpp @@ -33,15 +33,15 @@ MonsterInfo::MonsterInfo(): MonsterInfo::~MonsterInfo() { - //kill vectors in mSoundEffects - for_each ( mSounds.begin(), mSounds.end(), - make_dtor(mSounds)); + // kill vectors in mSoundEffects + for_each (mSounds.begin(), mSounds.end(), + make_dtor(mSounds)); mSounds.clear(); } void -MonsterInfo::addSound (SoundEvent event, std::string filename) +MonsterInfo::addSound(MonsterSoundEvent event, std::string filename) { if (mSounds.find(event) == mSounds.end()) { @@ -53,9 +53,9 @@ MonsterInfo::addSound (SoundEvent event, std::string filename) std::string -MonsterInfo::getSound (SoundEvent event) const +MonsterInfo::getSound(MonsterSoundEvent event) const { - std::map* >::const_iterator i; + std::map* >::const_iterator i; i = mSounds.find(event); diff --git a/src/resources/monsterinfo.h b/src/resources/monsterinfo.h index aa7db9f0..c9fbd4c9 100644 --- a/src/resources/monsterinfo.h +++ b/src/resources/monsterinfo.h @@ -31,12 +31,12 @@ #include "../being.h" -enum SoundEvent +enum MonsterSoundEvent { - EVENT_HIT, - EVENT_MISS, - EVENT_HURT, - EVENT_DIE + MONSTER_EVENT_HIT, + MONSTER_EVENT_MISS, + MONSTER_EVENT_HURT, + MONSTER_EVENT_DIE }; /** @@ -69,7 +69,7 @@ class MonsterInfo { mTargetCursorSize = targetCursorSize; } void - addSound(SoundEvent event, std::string filename); + addSound(MonsterSoundEvent event, std::string filename); const std::string& getName () const { return mName; }; @@ -81,13 +81,13 @@ class MonsterInfo getTargetCursorSize() const { return mTargetCursorSize; } std::string - getSound (SoundEvent event) const; + getSound(MonsterSoundEvent event) const; private: std::string mName; std::string mSprite; Being::TargetCursorSize mTargetCursorSize; - std::map* > mSounds; + std::map* > mSounds; }; #endif diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index 6d335b02..55d7f459 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.h @@ -24,11 +24,11 @@ #ifndef _TMW_SPRITEDEF_H #define _TMW_SPRITEDEF_H -#include "resource.h" - #include #include +#include "resource.h" + #include class Action; diff --git a/src/textparticle.cpp b/src/textparticle.cpp index dd01d2fe..4bc859cd 100644 --- a/src/textparticle.cpp +++ b/src/textparticle.cpp @@ -26,7 +26,8 @@ #include "graphics.h" TextParticle::TextParticle(Map *map, const std::string &text, - int colorR, int colorG, int colorB, gcn::Font *font): + int colorR, int colorG, int colorB, + gcn::Font *font): Particle(map), mText(text), mTextFont(font), @@ -41,8 +42,8 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const if (!mAlive) return; - int screenX = (int)mPosX + offsetX; - int screenY = (int)mPosY - int(mPosZ) + offsetY; + int screenX = (int) mPos.x + offsetX; + int screenY = (int) mPos.y - (int) mPos.z + offsetY; int alpha = 255; @@ -50,7 +51,7 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const { alpha *= mLifetimeLeft; alpha /= mFadeOut; - }; + } if (mLifetimePast < mFadeIn) { @@ -59,6 +60,6 @@ void TextParticle::draw(Graphics *graphics, int offsetX, int offsetY) const } graphics->setFont(mTextFont); - graphics->setColor(gcn::Color (mColorR, mColorG, mColorB, alpha)); + graphics->setColor(gcn::Color(mColorR, mColorG, mColorB, alpha)); graphics->drawText(mText, screenX, screenY, gcn::Graphics::CENTER); } diff --git a/src/textparticle.h b/src/textparticle.h index b365c885..34badb57 100644 --- a/src/textparticle.h +++ b/src/textparticle.h @@ -33,21 +33,26 @@ class TextParticle : public Particle { public: + /** + * Constructor. + */ TextParticle(Map *map, const std::string &text, - int colorR, int colorG, int colorB, gcn::Font *font); + int colorR, int colorG, int colorB, + gcn::Font *font); /** - * Draws the particle image + * Draws the particle image. */ virtual void draw(Graphics *graphics, int offsetX, int offsetY) const; // hack to improve text visibility - virtual int getPixelY() const { return (int)(mPosY + mPosZ); } + virtual int getPixelY() const + { return (int) (mPos.y + mPos.z); } private: - std::string mText; /**< Text of the particle */ - gcn::Font *mTextFont; /**< Font used for drawing the text */ - int mColorR, mColorG, mColorB; /**< Color used for drawing the text */ + std::string mText; /**< Text of the particle. */ + gcn::Font *mTextFont; /**< Font used for drawing the text. */ + int mColorR, mColorG, mColorB; /**< Color used for drawing the text. */ }; #endif diff --git a/src/utils/fastsqrt.h b/src/utils/fastsqrt.h index 78768149..b7b036e9 100644 --- a/src/utils/fastsqrt.h +++ b/src/utils/fastsqrt.h @@ -5,6 +5,8 @@ * http://www.math.purdue.edu/~clomont/Math/Papers/2003/InvSqrt.pdf * * Unfortunately the original creator of this function seems to be unknown. + * + * $Id$ */ float fastInvSqrt(float x) diff --git a/src/utils/minmax.h b/src/utils/minmax.h index 27eb2565..ea6ad9e0 100644 --- a/src/utils/minmax.h +++ b/src/utils/minmax.h @@ -18,6 +18,7 @@ * 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$ */ /** diff --git a/src/utils/trim.h b/src/utils/trim.h new file mode 100644 index 00000000..1b5311e6 --- /dev/null +++ b/src/utils/trim.h @@ -0,0 +1,53 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_UTILS_TRIM_H_ +#define _TMW_UTILS_TRIM_H_ + +#include + +/** + * Trims spaces off the end and the beginning of the given string. + * + * @param str the string to trim spaces off + */ +static void trim(std::string &str) +{ + std::string::size_type pos = str.find_last_not_of(' '); + if (pos != std::string::npos) + { + str.erase(pos + 1); + pos = str.find_first_not_of(' '); + if (pos != std::string::npos) + { + str.erase(0, pos); + } + } + else + { + // There is nothing else but whitespace in the string + str.clear(); + } +} + +#endif diff --git a/src/vector.h b/src/vector.h new file mode 100644 index 00000000..7a5da241 --- /dev/null +++ b/src/vector.h @@ -0,0 +1,134 @@ +/* + * The Mana World + * Copyright 2007 The Mana World Development Team + * + * This file is part of The Mana World. + * + * The Mana World is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * The Mana World is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with The Mana World; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * $Id$ + */ + +#ifndef _TMW_VECTOR_H_ +#define _TMW_VECTOR_H_ + +/** + * Vector class. Represents either a 3D point in space, a velocity or a force. + * Provides several convenient operator overloads. + */ +class Vector +{ + public: + /** + * Constructor. + */ + Vector(): + x(0.0f), + y(0.0f), + z(0.0f) + {} + + /** + * Constructor. + */ + Vector(float x, float y, float z): + x(x), + y(y), + z(z) + {} + + /** + * Copy constructor. + */ + Vector(const Vector &v): + x(v.x), + y(v.y), + z(v.z) + {} + + /** + * Scale vector operator. + */ + Vector operator*(float c) const + { + return Vector(x * c, + y * c, + z * c); + } + + /** + * In-place scale vector operator. + */ + void operator*=(float c) + { + x *= c; + y *= c; + z *= c; + } + + /** + * Scale vector operator. + */ + Vector operator/(float c) const + { + return Vector(x / c, + y / c, + z / c); + } + + /** + * Add vector operator. + */ + Vector operator+(const Vector &v) const + { + return Vector(x + v.x, + y + v.y, + z + v.z); + } + + /** + * In-place add vector operator. + */ + void operator+=(const Vector &v) + { + x += v.x; + y += v.y; + z += v.z; + } + + /** + * Substract vector operator. + */ + Vector operator-(const Vector &v) const + { + return Vector(x - v.x, + y - v.y, + z - v.z); + } + + /** + * In-place substract vector operator. + */ + void operator-=(const Vector &v) + { + x -= v.x; + y -= v.y; + z -= v.z; + } + + float x, y, z; +}; + +#endif diff --git a/tools/adler32.c b/tools/adler32.c new file mode 100644 index 00000000..4e851713 --- /dev/null +++ b/tools/adler32.c @@ -0,0 +1,67 @@ +/* + * adler32.c (c) 2006 Bjorn Lindeijer + * License: GPL, v2 or later + * + * Calculates Adler-32 checksums for all files passed as argument. + * + * Usage: adler32 [file]... + */ + +#include +#include + +/** + * Calculates the Adler-32 checksum for the given file. + */ +unsigned long fadler32(FILE *file) +{ + // Obtain file size + fseek(file, 0, SEEK_END); + long fileSize = ftell(file); + rewind(file); + + // Calculate Adler-32 checksum + char *buffer = (char*) malloc(fileSize); + fread(buffer, 1, fileSize, file); + unsigned long adler = adler32(0L, Z_NULL, 0); + adler = adler32(adler, (Bytef*) buffer, fileSize); + free(buffer); + + return adler; +} + +/** + * Prints out usage and exists. + */ +void print_usage() +{ + printf("Usage: adler32 [file]...\n"); + exit(0); +} + +int main(int argc, char *argv[]) +{ + int i; /**< Loops through arguments. */ + + if (argc == 1) + { + print_usage(); + } + + for (i = 1; i < argc; ++i) + { + FILE *file = fopen(argv[i], "r"); + + if (!file) + { + printf("Error while opening '%s' for reading!\n", argv[i]); + exit(1); + } + + unsigned long adler = fadler32(file); + printf("%s %lx\n", argv[i], adler); + fclose(file); + } + + return 0; +} -- cgit v1.2.3-70-g09d2 From 7afe9d904f11fc65f02959798dfc6abb3660d660 Mon Sep 17 00:00:00 2001 From: Guillaume Melquiond Date: Sun, 21 Oct 2007 19:06:57 +0000 Subject: Converted dialog box to layout handler. --- ChangeLog | 1 + src/gui/buy.cpp | 71 +++++++++++++-------------------------------------------- src/gui/buy.h | 8 +------ 3 files changed, 18 insertions(+), 62 deletions(-) (limited to 'src/gui/buy.h') diff --git a/ChangeLog b/ChangeLog index 0bd9bdd3..b3f31c34 100644 --- a/ChangeLog +++ b/ChangeLog @@ -27,6 +27,7 @@ * src/gui/menuwindow.cpp: Fixed missing pixels at bottom and right. * src/gui/window.cpp, src/gui/window.h: Changed to use default values when restoring missing settings. + * src/gui/buy.cpp, src/gui/buy.h: Converted to layout handler. 2007-10-20 Guillaume Melquiond diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 7912bf13..a122783e 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -31,6 +31,8 @@ #include "shoplistbox.h" #include "slider.h" +#include "widgets/layout.h" + #include "../npc.h" #include "../net/gameserver/player.h" #include "../resources/itemdb.h" @@ -76,18 +78,20 @@ BuyDialog::BuyDialog(): mShopItemList->addSelectionListener(this); mSlider->addActionListener(this); - add(mScrollArea); - add(mSlider); - add(mQuantityLabel); - add(mBuyButton); - add(mQuitButton); - add(mIncreaseButton); - add(mDecreaseButton); - add(mMoneyLabel); - add(mItemDescLabel); - add(mItemEffectLabel); - - addWindowListener(this); + place(0, 0, mScrollArea, 5).setPadding(3); + place(0, 1, mQuantityLabel, 2); + place(2, 1, mSlider, 3); + place(0, 2, mMoneyLabel, 5); + place(0, 3, mItemEffectLabel, 5); + place(0, 4, mItemDescLabel, 5); + place(0, 5, mDecreaseButton); + place(1, 5, mIncreaseButton); + place(3, 5, mBuyButton); + place(4, 5, mQuitButton); + Layout &layout = getLayout(); + layout.setRowHeight(0, Layout::FILL); + layout.setColWidth(2, Layout::FILL); + loadWindowState("Buy"); setLocationRelativeTo(getParent()); } @@ -189,49 +193,6 @@ void BuyDialog::selectionChanged(const SelectionEvent &event) mSlider->gcn::Slider::setScale(1, mMaxItems); } -void BuyDialog::windowResized(const WindowEvent &event) -{ - gcn::Rectangle area = getChildrenArea(); - int width = area.width; - int height = area.height; - - mDecreaseButton->setPosition(8, height - 8 - mDecreaseButton->getHeight()); - mIncreaseButton->setPosition( - mDecreaseButton->getX() + mDecreaseButton->getWidth() + 5, - mDecreaseButton->getY()); - - mQuitButton->setPosition( - width - 8 - mQuitButton->getWidth(), - height - 8 - mQuitButton->getHeight()); - mBuyButton->setPosition( - mQuitButton->getX() - 5 - mBuyButton->getWidth(), - mQuitButton->getY()); - - mItemDescLabel->setDimension(gcn::Rectangle(8, - mBuyButton->getY() - 5 - mItemDescLabel->getHeight(), - width - 16, - mItemDescLabel->getHeight())); - mItemEffectLabel->setDimension(gcn::Rectangle(8, - mItemDescLabel->getY() - 5 - mItemEffectLabel->getHeight(), - width - 16, - mItemEffectLabel->getHeight())); - mMoneyLabel->setDimension(gcn::Rectangle(8, - mItemEffectLabel->getY() - 5 - mMoneyLabel->getHeight(), - width - 16, - mMoneyLabel->getHeight())); - - mQuantityLabel->setPosition( - width - mQuantityLabel->getWidth() - 8, - mMoneyLabel->getY() - 5 - mQuantityLabel->getHeight()); - mSlider->setDimension(gcn::Rectangle(8, - mQuantityLabel->getY(), - mQuantityLabel->getX() - 8 - 8, - 10)); - - mScrollArea->setDimension(gcn::Rectangle(8, 8, width - 16, - mSlider->getY() - 5 - 8)); -} - void BuyDialog::updateButtonsAndLabels() { diff --git a/src/gui/buy.h b/src/gui/buy.h index 63d25583..4e129611 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -40,8 +40,7 @@ class ListBox; * * \ingroup Interface */ -class BuyDialog : public Window, public gcn::ActionListener, SelectionListener, - WindowListener +class BuyDialog : public Window, public gcn::ActionListener, SelectionListener { public: /** @@ -99,11 +98,6 @@ class BuyDialog : public Window, public gcn::ActionListener, SelectionListener, void updateButtonsAndLabels(); - /** - * Called whenever the window is resized. - */ - void windowResized(const WindowEvent &event); - private: gcn::Button *mBuyButton; gcn::Button *mQuitButton; -- cgit v1.2.3-70-g09d2 From 4b9e2b6c41e740a3eac10078d5fa4fbc63788bbe Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Fri, 11 Apr 2008 13:31:52 +0000 Subject: Ported trunk over to Guichan 0.8.0. Based on merge from 0.0 branch, but because of quite a bit of GUI differences there were additional changes and probably additional issues. You have been warned. ;) Merged revisions 4045-4049,4051-4059 via svnmerge from https://themanaworld.svn.sourceforge.net/svnroot/themanaworld/tmw/branches/0.0 ........ r4045 | b_lindeijer | 2008-04-07 17:23:07 +0200 (Mon, 07 Apr 2008) | 3 lines Upgraded to Guichan 0.8.0 (merge from guichan-0.8 branch, except for gcn::TabbedArea usage) ........ r4059 | b_lindeijer | 2008-04-09 16:25:42 +0200 (Wed, 09 Apr 2008) | 2 lines Fixed problem with row height in shop list box. ........ --- ChangeLog | 36 +++++++++++++ INSTALL | 2 +- NEWS | 2 + src/CMakeLists.txt | 2 - src/Makefile.am | 4 +- src/gui/button.cpp | 2 +- src/gui/buy.cpp | 5 +- src/gui/buy.h | 9 ++-- src/gui/char_select.cpp | 7 ++- src/gui/chat.cpp | 26 ++++----- src/gui/checkbox.cpp | 6 +-- src/gui/checkbox.h | 2 +- src/gui/guildlistbox.cpp | 19 ++++--- src/gui/guildlistbox.h | 18 ------- src/gui/guildwindow.cpp | 4 +- src/gui/inttextbox.cpp | 2 +- src/gui/inventorywindow.cpp | 2 +- src/gui/inventorywindow.h | 9 ++-- src/gui/itemcontainer.cpp | 17 +++--- src/gui/itemcontainer.h | 20 ++++--- src/gui/itemshortcutwindow.cpp | 9 ++-- src/gui/itemshortcutwindow.h | 7 ++- src/gui/listbox.cpp | 21 -------- src/gui/listbox.h | 31 ----------- src/gui/login.cpp | 2 +- src/gui/playerbox.cpp | 8 +-- src/gui/playerbox.h | 2 +- src/gui/quitdialog.cpp | 12 ++--- src/gui/radiobutton.cpp | 2 +- src/gui/scrollarea.cpp | 24 ++++----- src/gui/scrollarea.h | 2 +- src/gui/selectionlistener.h | 68 ------------------------ src/gui/sell.cpp | 2 +- src/gui/sell.h | 7 ++- src/gui/setup_audio.cpp | 4 +- src/gui/setup_joystick.cpp | 6 +-- src/gui/setup_video.cpp | 18 +++---- src/gui/shoplistbox.cpp | 29 +--------- src/gui/shoplistbox.h | 28 ++-------- src/gui/slider.cpp | 2 +- src/gui/tabbedcontainer.cpp | 4 +- src/gui/textbox.cpp | 4 +- src/gui/textfield.cpp | 8 +-- src/gui/textfield.h | 2 +- src/gui/trade.cpp | 2 +- src/gui/trade.h | 6 +-- src/gui/widgets/dropdown.cpp | 15 +++--- src/gui/widgets/dropdown.h | 2 +- src/gui/window.cpp | 117 ++++++++--------------------------------- src/gui/window.h | 77 +++------------------------ src/gui/windowlistener.h | 86 ------------------------------ 51 files changed, 213 insertions(+), 588 deletions(-) delete mode 100644 src/gui/selectionlistener.h delete mode 100644 src/gui/windowlistener.h (limited to 'src/gui/buy.h') diff --git a/ChangeLog b/ChangeLog index 0477f10b..18f172fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,11 @@ Fixed some compiler warnings and don't try to load particle effects when no file is set. +2008-04-09 Bjørn Lindeijer + + * src/gui/shoplistbox.cpp, src/gui/shoplistbox.h: Fixed problem with + row height in shop list box. + 2008-04-08 Bjørn Lindeijer * src/map.cpp, src/gui/viewport.cpp, src/tileset.h, src/map.h, @@ -297,6 +302,15 @@ design decisions. * data/items.xml: Fixed a few messed up slot numbers. +2008-01-28 Bjørn Lindeijer + + * src/gui/sell.cpp, src/gui/window.cpp, src/gui/inventorywindow.h, + src/gui/buy.h, src/gui/itemshortcutwindow.cpp, + src/gui/inventorywindow.cpp, src/gui/buy.cpp, src/gui/sell.h, + src/gui/window.h, src/gui/windowlistener.h, + src/gui/itemshortcutwindow.h, src/CMakeLists.txt, src/Makefile.am: + Used the gcn::WidgetListener instead of our WindowListener. + 2008-01-26 Bjørn Lindeijer * src/gui/truetypefont.cpp: Image alpha should also be set to 1, in @@ -316,6 +330,28 @@ * src/net/beinghandler.cpp, src/resources/spritedef.h: Fixed broken communication of attack directions. +2008-01-23 Bjørn Lindeijer + + * src/gui/char_server.cpp, src/gui/window.cpp, src/gui/checkbox.h, + src/gui/playerbox.h, src/gui/button.cpp, src/gui/chat.cpp, + src/gui/slider.cpp, src/gui/tabbedcontainer.cpp, src/gui/textfield.h, + src/gui/shoplistbox.cpp, src/gui/register.cpp, + src/gui/radiobutton.cpp, src/gui/textbox.cpp, src/gui/login.cpp, + src/gui/setup_audio.cpp, src/gui/setup_video.cpp, + src/gui/textfield.cpp, src/gui/playerbox.cpp, + src/gui/setup_joystick.cpp, src/gui/scrollarea.h, + src/gui/windowlistener.h, src/gui/checkbox.cpp, + src/gui/scrollarea.cpp: Compile against Guichan 0.8.0. Some issues + with ShopListBox left and not trying to use their new TabbedArea, + SelectionListener and WidgetListener yet. Also needs more testing. + * src/gui/trade.cpp, src/gui/sell.cpp, src/gui/inventorywindow.h, + src/gui/selectionlistener.h, src/gui/itemcontainer.h, + src/gui/shoplistbox.cpp, src/gui/shoplistbox.h, src/gui/listbox.h, + src/gui/buy.h, src/gui/inventorywindow.cpp, src/gui/buy.cpp, + src/gui/itemcontainer.cpp, src/gui/sell.h, src/gui/trade.h, + src/gui/listbox.cpp, src/CMakeLists.txt, src/Makefile.am: Used the + gcn::SelectionListener instead of our own. + 2008-01-20 Philipp Sehmisch * data/items.xml: Added max-per-slot property to all items. diff --git a/INSTALL b/INSTALL index ea8a4f81..a346a2e5 100644 --- a/INSTALL +++ b/INSTALL @@ -21,7 +21,7 @@ and some libraries. The required libraries are: * SDL_image http://www.libsdl.org/projects/SDL_image/ * SDL_ttf http://www.libsdl.org/projects/SDL_ttf/ * ENet 1.2 http://enet.bespin.org/ -* Guichan 0.7.x http://guichan.sourceforge.net/ +* Guichan 0.8.x http://guichan.sourceforge.net/ * libxml2 http://www.xmlsoft.org/ * physfs 1.0.x http://icculus.org/physfs/ * zlib 1.2.x http://www.gzip.org/zlib/ diff --git a/NEWS b/NEWS index ebdae676..51a181d0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +0.0.24.1 (7 April 2008) + 0.0.24 (24 December 2007) - Added female specific hair styles - Added user-definable key settings diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9cda186d..b783efcb 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -148,7 +148,6 @@ SET(SRCS gui/scrollarea.h gui/sdlinput.cpp gui/sdlinput.h - gui/selectionlistener.h gui/sell.cpp gui/sell.h gui/serverdialog.cpp @@ -198,7 +197,6 @@ SET(SRCS gui/window.h gui/windowcontainer.cpp gui/windowcontainer.h - gui/windowlistener.h net/beinghandler.cpp net/beinghandler.h net/buysellhandler.cpp diff --git a/src/Makefile.am b/src/Makefile.am index d9b3fc8d..c46fe481 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -102,7 +102,6 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ gui/scrollarea.h \ gui/sdlinput.cpp \ gui/sdlinput.h \ - gui/selectionlistener.h \ gui/sell.cpp \ gui/sell.h \ gui/serverdialog.cpp \ @@ -150,7 +149,6 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ gui/window.h \ gui/windowcontainer.cpp \ gui/windowcontainer.h \ - gui/windowlistener.h \ net/beinghandler.h \ net/beinghandler.cpp \ net/buysellhandler.h \ @@ -340,4 +338,4 @@ tmw_SOURCES = gui/widgets/dropdown.cpp \ INCLUDES = \ $(all_includes) \ -DTMW_DATADIR=\""$(pkgdatadir)/"\" \ - -DLOCALEDIR=\""$(localedir)"\" \ No newline at end of file + -DLOCALEDIR=\""$(localedir)"\" diff --git a/src/gui/button.cpp b/src/gui/button.cpp index e47f90f8..c6bc4ccb 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -82,7 +82,7 @@ Button::Button(const std::string& caption, const std::string &actionEventId, void Button::init() { - setBorderSize(0); + setFrameSize(0); if (mInstances == 0) { diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index d2e12a85..49d19675 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -178,9 +178,8 @@ void BuyDialog::action(const gcn::ActionEvent &event) } } -void BuyDialog::selectionChanged(const SelectionEvent &event) +void BuyDialog::valueChanged(const gcn::SelectionEvent &event) { - // Reset amount of items and update labels mAmountItems = 1; mSlider->setValue(1); @@ -192,7 +191,7 @@ void BuyDialog::selectionChanged(const SelectionEvent &event) void BuyDialog::updateButtonsAndLabels() { - int selectedItem = mShopItemList->getSelected(); + const int selectedItem = mShopItemList->getSelected(); int price = 0; if (selectedItem > -1) diff --git a/src/gui/buy.h b/src/gui/buy.h index 4e129611..ec7419be 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -25,9 +25,9 @@ #define _TMW_BUY_H #include +#include #include "window.h" -#include "selectionlistener.h" #include "../guichanfwd.h" @@ -40,7 +40,8 @@ class ListBox; * * \ingroup Interface */ -class BuyDialog : public Window, public gcn::ActionListener, SelectionListener +class BuyDialog : public Window, public gcn::ActionListener, + gcn::SelectionListener { public: /** @@ -82,10 +83,8 @@ class BuyDialog : public Window, public gcn::ActionListener, SelectionListener /** * Updates the labels according to the selected item. - * - * @see SelectionListener::selectionChanged */ - void selectionChanged(const SelectionEvent &event); + void valueChanged(const gcn::SelectionEvent &event); /** * Returns the name of item number i in the shop inventory. diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index a691f4ec..b2d3b53e 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -323,7 +323,7 @@ CharCreateDialog::CharCreateDialog(Window *parent, int slot): mFemale->setPosition( 100, 120 ); // Default to a Male character - mMale->setMarked(true); + mMale->setSelected(true); mMale->setActionEventId("gender"); mFemale->setActionEventId("gender"); @@ -375,13 +375,12 @@ CharCreateDialog::action(const gcn::ActionEvent &event) mCreateButton->setEnabled(false); unsigned int genderSelected; - if( mMale->isMarked() ){ + if (mMale->isSelected()) { genderSelected = GENDER_MALE; } else { genderSelected = GENDER_FEMALE; } - Net::AccountServer::Account::createCharacter( getName(), mPlayer->getHairStyle(), @@ -418,7 +417,7 @@ CharCreateDialog::action(const gcn::ActionEvent &event) UpdateSliders(); } else if (event.getId() == "gender"){ - if( mMale->isMarked() ) { + if (mMale->isSelected()) { mPlayer->setGender(GENDER_MALE); } else { mPlayer->setGender(GENDER_FEMALE); diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index f6b54d29..1efee8ed 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -67,14 +67,14 @@ ChatWindow::ChatWindow(): textOutput->setMaxRow((int) config.getValue("ChatLogLength", 0)); ScrollArea *scrollArea = new ScrollArea(textOutput); scrollArea->setPosition( - scrollArea->getBorderSize(), scrollArea->getBorderSize()); + scrollArea->getFrameSize(), scrollArea->getFrameSize()); scrollArea->setScrollPolicy( gcn::ScrollArea::SHOW_NEVER, gcn::ScrollArea::SHOW_ALWAYS); scrollArea->setOpaque(false); GCContainer *tab = new GCContainer(); - tab->setWidth(getWidth() - 2 * tab->getBorderSize()); - tab->setHeight(getHeight() - 2 * tab->getBorderSize()); + tab->setWidth(getWidth() - 2 * tab->getFrameSize()); + tab->setHeight(getHeight() - 2 * tab->getFrameSize()); tab->setOpaque(false); tab->add(scrollArea); @@ -109,15 +109,15 @@ ChatWindow::logic() const gcn::Rectangle area = getChildrenArea(); - mChatInput->setPosition(mChatInput->getBorderSize(), + mChatInput->setPosition(mChatInput->getFrameSize(), area.height - mChatInput->getHeight() - - mChatInput->getBorderSize()); - mChatInput->setWidth(area.width - 2 * mChatInput->getBorderSize()); - mContainer->setWidth(area.width - 2 * mContainer->getBorderSize()); - mContainer->setHeight(area.height - 2 * mContainer->getBorderSize() - + mChatInput->getFrameSize()); + mChatInput->setWidth(area.width - 2 * mChatInput->getFrameSize()); + mContainer->setWidth(area.width - 2 * mContainer->getFrameSize()); + mContainer->setHeight(area.height - 2 * mContainer->getFrameSize() - mChatInput->getHeight() - 5); - mScrollArea->setWidth(area.width - 2 * mScrollArea->getBorderSize()); - mScrollArea->setHeight(area.height - 2 * mScrollArea->getBorderSize() - + mScrollArea->setWidth(area.width - 2 * mScrollArea->getFrameSize()); + mScrollArea->setHeight(area.height - 2 * mScrollArea->getFrameSize() - mChatInput->getHeight() - 26); Window::logic(); } @@ -475,12 +475,12 @@ ChatWindow::createNewChannelTab(std::string channelName) textOutput->setOpaque(false); textOutput->disableLinksAndUserColors(); ScrollArea *scrollArea = new ScrollArea(textOutput); - scrollArea->setPosition(scrollArea->getBorderSize(), scrollArea->getBorderSize()); + scrollArea->setPosition(scrollArea->getFrameSize(), scrollArea->getFrameSize()); scrollArea->setScrollPolicy(gcn::ScrollArea::SHOW_NEVER, gcn::ScrollArea::SHOW_ALWAYS); scrollArea->setOpaque(false); GCContainer *tab = new GCContainer(); - tab->setWidth(getWidth() - 2 * tab->getBorderSize()); - tab->setHeight(getHeight() - 2 * tab->getBorderSize()); + tab->setWidth(getWidth() - 2 * tab->getFrameSize()); + tab->setHeight(getHeight() - 2 * tab->getFrameSize()); tab->add(scrollArea); tab->setOpaque(false); mContainer->addTab(tab, channelName); diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp index fab4780c..5b300d33 100644 --- a/src/gui/checkbox.cpp +++ b/src/gui/checkbox.cpp @@ -34,8 +34,8 @@ Image *CheckBox::checkBoxChecked; Image *CheckBox::checkBoxDisabled; Image *CheckBox::checkBoxDisabledChecked; -CheckBox::CheckBox(const std::string& caption, bool marked): - gcn::CheckBox(caption, marked) +CheckBox::CheckBox(const std::string& caption, bool selected): + gcn::CheckBox(caption, selected) { if (instances == 0) { @@ -68,7 +68,7 @@ void CheckBox::drawBox(gcn::Graphics* graphics) { Image *box; - if (mMarked) { + if (isSelected()) { if (isEnabled()) { box = checkBoxChecked; } else { diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h index 468a7f38..262e63ae 100644 --- a/src/gui/checkbox.h +++ b/src/gui/checkbox.h @@ -40,7 +40,7 @@ class CheckBox : public gcn::CheckBox { /** * Constructor. */ - CheckBox(const std::string& caption, bool marked = false); + CheckBox(const std::string& caption, bool selected = false); /** * Destructor. diff --git a/src/gui/guildlistbox.cpp b/src/gui/guildlistbox.cpp index 1a392d2d..11661235 100644 --- a/src/gui/guildlistbox.cpp +++ b/src/gui/guildlistbox.cpp @@ -30,27 +30,26 @@ GuildListBox::GuildListBox(): ListBox(NULL) { - } void GuildListBox::draw(gcn::Graphics *graphics) { if (!mListModel) return; - + graphics->setColor(gcn::Color(110, 160, 255)); graphics->setFont(getFont()); - + int fontHeight = getFont()->getHeight(); - + // Draw rectangle below the selected list element if (mSelected >= 0) { graphics->fillRectangle(gcn::Rectangle(0, fontHeight * mSelected, getWidth(), fontHeight)); } - + // TODO: Add online status image - + // Draw the list elements for (int i = 0, y = 0; i < mListModel->getNumberOfElements(); @@ -71,7 +70,7 @@ void GuildListBox::setSelected(int selected) // Update mSelected with bounds checking mSelected = std::min(mListModel->getNumberOfElements() - 1, std::max(-1, selected)); - + gcn::Widget *parent; parent = (gcn::Widget*)getParent(); if (parent) @@ -82,8 +81,8 @@ void GuildListBox::setSelected(int selected) parent->showWidgetPart(this, scroll); } } - - fireSelectionChangedEvent(); + + distributeValueChangedEvent(); } void GuildListBox::mousePressed(gcn::MouseEvent &event) @@ -93,6 +92,6 @@ void GuildListBox::mousePressed(gcn::MouseEvent &event) // TODO: Add guild functions, ie private messaging int y = event.getY(); setSelected(y / getFont()->getHeight()); - generateAction(); + distributeActionEvent(); } } diff --git a/src/gui/guildlistbox.h b/src/gui/guildlistbox.h index befaef1f..262012a4 100644 --- a/src/gui/guildlistbox.h +++ b/src/gui/guildlistbox.h @@ -49,24 +49,6 @@ public: void mousePressed(gcn::MouseEvent &event); - /** - * Adds a listener to the list that's notified each time a change to - * the selection occurs. - */ - void addSelectionListener(SelectionListener *listener) - { - mListeners.push_back(listener); - } - - /** - * Removes a listener from the list that's notified each time a change - * to the selection occurs. - */ - void removeSelectionListener(SelectionListener *listener) - { - mListeners.remove(listener); - } - /** * Sets the index of the selected element. */ diff --git a/src/gui/guildwindow.cpp b/src/gui/guildwindow.cpp index 970c6ce1..eb0faa35 100644 --- a/src/gui/guildwindow.cpp +++ b/src/gui/guildwindow.cpp @@ -173,8 +173,8 @@ void GuildWindow::newGuildTab(const std::string &guildName) // Create new tab GCContainer *tab = new GCContainer(); - tab->setWidth(getWidth() - 2 * tab->getBorderSize()); - tab->setHeight(getHeight() - 2 * tab->getBorderSize()); + tab->setWidth(getWidth() - 2 * tab->getFrameSize()); + tab->setHeight(getHeight() - 2 * tab->getFrameSize()); tab->setOpaque(false); ListBox *list = new ListBox(); list->setListModel(player_node->getGuild(guildName)); diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp index 5ae3dd93..17e87afd 100644 --- a/src/gui/inttextbox.cpp +++ b/src/gui/inttextbox.cpp @@ -51,7 +51,7 @@ IntTextBox::keyPressed(gcn::KeyEvent &event) int i; s >> i; setInt(i); - generateAction(); + distributeActionEvent(); } void IntTextBox::setRange(int min, int max) diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 0ef1ab35..bd224cf0 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -144,7 +144,7 @@ void InventoryWindow::action(const gcn::ActionEvent &event) } } -void InventoryWindow::selectionChanged(const SelectionEvent &event) +void InventoryWindow::valueChanged(const gcn::SelectionEvent &event) { Item *item = mItems->getItem(); ItemInfo const *info = item ? &item->getInfo() : NULL; diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index 34883c1c..01fb118c 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.h @@ -26,10 +26,9 @@ #include #include - +#include #include -#include "selectionlistener.h" #include "window.h" #include "../guichanfwd.h" @@ -45,7 +44,7 @@ class ItemContainer; class InventoryWindow : public Window, public gcn::ActionListener, public gcn::KeyListener, - public SelectionListener + public gcn::SelectionListener { public: /** @@ -82,10 +81,8 @@ class InventoryWindow : public Window, /** * Updates labels to currently selected item. - * - * @see SelectionListener::selectionChanged. */ - void selectionChanged(const SelectionEvent &event); + void valueChanged(const gcn::SelectionEvent &event); private: void updateButtons(); /**< Updates button states. */ diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 1abb8f0b..eddb6011 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -24,9 +24,9 @@ #include "itemcontainer.h" #include +#include #include "sdlinput.h" -#include "selectionlistener.h" #include "../graphics.h" #include "../inventory.h" @@ -159,20 +159,19 @@ void ItemContainer::setSelectedItem(Item *item) if (mSelectedItem != item) { mSelectedItem = item; - fireSelectionChangedEvent(); + distributeValueChangedEvent(); } } -void -ItemContainer::fireSelectionChangedEvent() +void ItemContainer::distributeValueChangedEvent() { - SelectionEvent event(this); - SelectionListeners::iterator i_end = mListeners.end(); - SelectionListeners::iterator i; + SelectionListenerIterator iter; - for (i = mListeners.begin(); i != i_end; ++i) + for (iter = mSelectionListeners.begin(); iter != mSelectionListeners.end(); + ++iter) { - (*i)->selectionChanged(event); + gcn::SelectionEvent event(this); + (*iter)->valueChanged(event); } } diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index 8be338dd..fad59171 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.h @@ -34,7 +34,10 @@ class Image; class Inventory; class Item; -class SelectionListener; + +namespace gcn { + class SelectionListener; +} /** * An item container. Used to show items in inventory and trade dialog. @@ -104,18 +107,18 @@ class ItemContainer : public gcn::Widget, * Adds a listener to the list that's notified each time a change to * the selection occurs. */ - void addSelectionListener(SelectionListener *listener) + void addSelectionListener(gcn::SelectionListener *listener) { - mListeners.push_back(listener); + mSelectionListeners.push_back(listener); } /** * Removes a listener from the list that's notified each time a change * to the selection occurs. */ - void removeSelectionListener(SelectionListener *listener) + void removeSelectionListener(gcn::SelectionListener *listener) { - mListeners.remove(listener); + mSelectionListeners.remove(listener); } enum { @@ -145,7 +148,7 @@ class ItemContainer : public gcn::Widget, /** * Sends out selection events to the list of selection listeners. */ - void fireSelectionChangedEvent(); + void distributeValueChangedEvent(); /** * Gets the slot index based on the cursor position. @@ -164,7 +167,10 @@ class ItemContainer : public gcn::Widget, bool mSwapItems; int mDragPosX, mDragPosY; - std::list mListeners; + typedef std::list SelectionListenerList; + typedef SelectionListenerList::iterator SelectionListenerIterator; + + SelectionListenerList mSelectionListeners; }; #endif diff --git a/src/gui/itemshortcutwindow.cpp b/src/gui/itemshortcutwindow.cpp index cf266290..c7b2bd05 100644 --- a/src/gui/itemshortcutwindow.cpp +++ b/src/gui/itemshortcutwindow.cpp @@ -38,7 +38,7 @@ ItemShortcutWindow::ItemShortcutWindow() mItems = new ItemShortcutContainer(); - int border = SCROLL_PADDING * 2 + getPadding() * 2; + const int border = SCROLL_PADDING * 2 + getPadding() * 2; setMinWidth(mItems->getBoxWidth() + border); setMinHeight(mItems->getBoxHeight() + border); setMaxWidth(mItems->getBoxWidth() * mItems->getMaxItems() + border); @@ -50,7 +50,6 @@ ItemShortcutWindow::ItemShortcutWindow() add(mInvenScroll); - addWindowListener(this); loadWindowState("ItemShortcut"); } @@ -65,9 +64,11 @@ void ItemShortcutWindow::logic() Window::logic(); } -void ItemShortcutWindow::windowResized(const WindowEvent &event) +void ItemShortcutWindow::widgetResized(const gcn::Event &event) { - const gcn::Rectangle area = getChildrenArea(); + Window::widgetResized(event); + + const gcn::Rectangle &area = getChildrenArea(); mInvenScroll->setSize( area.width - SCROLL_PADDING, diff --git a/src/gui/itemshortcutwindow.h b/src/gui/itemshortcutwindow.h index 1dde8686..51685e49 100644 --- a/src/gui/itemshortcutwindow.h +++ b/src/gui/itemshortcutwindow.h @@ -25,7 +25,6 @@ #define _TMW_ITEMSHORTCUTWINDOW_H #include "window.h" -#include "windowlistener.h" #include "../guichanfwd.h" @@ -36,7 +35,7 @@ class ItemShortcutContainer; * * \ingroup Interface */ -class ItemShortcutWindow : public Window, WindowListener +class ItemShortcutWindow : public Window { public: /** @@ -55,9 +54,9 @@ class ItemShortcutWindow : public Window, WindowListener void logic(); /** - * Called whenever the window is resized. + * Called whenever the widget changes size. */ - void windowResized(const WindowEvent &event); + void widgetResized(const gcn::Event &event); private: ItemShortcutContainer *mItems; diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index 61c7e078..ac18c2cd 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -23,8 +23,6 @@ #include "listbox.h" -#include "selectionlistener.h" - #include #include #include @@ -67,13 +65,6 @@ void ListBox::draw(gcn::Graphics *graphics) } } -void -ListBox::setSelected(int selected) -{ - gcn::ListBox::setSelected(selected); - fireSelectionChangedEvent(); -} - void ListBox::mouseDragged(gcn::MouseEvent &event) { @@ -81,15 +72,3 @@ ListBox::mouseDragged(gcn::MouseEvent &event) // selection to be updated as is default in many GUIs. mousePressed(event); } - -void ListBox::fireSelectionChangedEvent() -{ - SelectionEvent event(this); - SelectionListeners::iterator i_end = mListeners.end(); - SelectionListeners::iterator i; - - for (i = mListeners.begin(); i != i_end; ++i) - { - (*i)->selectionChanged(event); - } -} diff --git a/src/gui/listbox.h b/src/gui/listbox.h index 21172a22..03a8b541 100644 --- a/src/gui/listbox.h +++ b/src/gui/listbox.h @@ -50,37 +50,6 @@ class ListBox : public gcn::ListBox void draw(gcn::Graphics *graphics); void mouseDragged(gcn::MouseEvent &event); - - /** - * Adds a listener to the list that's notified each time a change to - * the selection occurs. - */ - void addSelectionListener(SelectionListener *listener) - { - mListeners.push_back(listener); - } - - /** - * Removes a listener from the list that's notified each time a change - * to the selection occurs. - */ - void removeSelectionListener(SelectionListener *listener) - { - mListeners.remove(listener); - } - - /** - * Sets the index of the selected element. - */ - virtual void setSelected(int selected); - - protected: - /** - * Sends out selection events to the list of selection listeners. - */ - void fireSelectionChangedEvent(); - - std::list mListeners; }; #endif diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 57ad00c5..f1b32d48 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -94,7 +94,7 @@ LoginDialog::action(const gcn::ActionEvent &event) { mLoginData->username = mUserField->getText(); mLoginData->password = mPassField->getText(); - mLoginData->remember = mKeepCheck->isMarked(); + mLoginData->remember = mKeepCheck->isSelected(); mLoginData->registerLogin = false; mOkButton->setEnabled(false); diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index 8e5f1827..2c633b72 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -39,7 +39,7 @@ ImageRect PlayerBox::background; PlayerBox::PlayerBox(const Player *player): mPlayer(player) { - setBorderSize(2); + setFrameSize(2); if (instances == 0) { @@ -83,7 +83,7 @@ PlayerBox::draw(gcn::Graphics *graphics) { // Draw character int x, y, bs; - bs = getBorderSize(); + bs = getFrameSize(); x = getWidth() / 2 - 16 + bs; y = getHeight() / 2 + bs; mPlayer->draw(static_cast(graphics), x, y); @@ -91,10 +91,10 @@ PlayerBox::draw(gcn::Graphics *graphics) } void -PlayerBox::drawBorder(gcn::Graphics *graphics) +PlayerBox::drawFrame(gcn::Graphics *graphics) { int w, h, bs; - bs = getBorderSize(); + bs = getFrameSize(); w = getWidth() + bs * 2; h = getHeight() + bs * 2; diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h index 6bba1b51..c226e750 100644 --- a/src/gui/playerbox.h +++ b/src/gui/playerbox.h @@ -64,7 +64,7 @@ class PlayerBox : public gcn::ScrollArea /** * Draws the background and border of the scroll area. */ - void drawBorder(gcn::Graphics *graphics); + void drawFrame(gcn::Graphics *graphics); private: const Player *mPlayer; /**< The character used for display */ diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index c9d974a6..7ed4f913 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -65,13 +65,13 @@ QuitDialog::QuitDialog(bool* quitGame, QuitDialog** pointerToMe): state == STATE_LOGIN_ATTEMPT || state == STATE_UPDATE) { - mForceQuit->setMarked(true); + mForceQuit->setSelected(true); add(mForceQuit); } else { // Only added if we are connected to an accountserver or gameserver - mLogoutQuit->setMarked(true); + mLogoutQuit->setSelected(true); add(mLogoutQuit); add(mSwitchAccountServer); @@ -104,11 +104,11 @@ QuitDialog::action(const gcn::ActionEvent &event) { if (event.getId() == "ok") { - if (mForceQuit->isMarked()) + if (mForceQuit->isSelected()) { state = STATE_FORCE_QUIT; } - else if (mLogoutQuit->isMarked()) + else if (mLogoutQuit->isSelected()) { if ((state == STATE_GAME) && (mQuitGame)) { @@ -116,7 +116,7 @@ QuitDialog::action(const gcn::ActionEvent &event) } state = STATE_EXIT; } - else if (mSwitchAccountServer->isMarked()) + else if (mSwitchAccountServer->isSelected()) { if ((state == STATE_GAME) && (mQuitGame)) { @@ -124,7 +124,7 @@ QuitDialog::action(const gcn::ActionEvent &event) } state = STATE_SWITCH_ACCOUNTSERVER_ATTEMPT; } - else if (mSwitchCharacter->isMarked()) + else if (mSwitchCharacter->isSelected()) { if (mQuitGame) *mQuitGame = true; diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp index e318116a..0ac4dea8 100644 --- a/src/gui/radiobutton.cpp +++ b/src/gui/radiobutton.cpp @@ -67,7 +67,7 @@ void RadioButton::drawBox(gcn::Graphics* graphics) { Image *box = NULL; - if (mMarked) { + if (isSelected()) { if (isEnabled()) { box = radioChecked; } else { diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index cf555ef4..97384fa3 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -153,12 +153,12 @@ void ScrollArea::logic() if (getHorizontalScrollPolicy() == gcn::ScrollArea::SHOW_NEVER) { content->setWidth(getChildrenArea().width - - 2 * content->getBorderSize()); + 2 * content->getFrameSize()); } if (getVerticalScrollPolicy() == gcn::ScrollArea::SHOW_NEVER) { content->setHeight(getChildrenArea().height - - 2 * content->getBorderSize()); + 2 * content->getFrameSize()); } } } @@ -204,15 +204,15 @@ void ScrollArea::draw(gcn::Graphics *graphics) { graphics->pushClipArea(getChildrenArea()); - if (content->getBorderSize() > 0) + if (content->getFrameSize() > 0) { gcn::Rectangle rec = content->getDimension(); - rec.x -= content->getBorderSize(); - rec.y -= content->getBorderSize(); - rec.width += 2 * content->getBorderSize(); - rec.height += 2 * content->getBorderSize(); + rec.x -= content->getFrameSize(); + rec.y -= content->getFrameSize(); + rec.width += 2 * content->getFrameSize(); + rec.height += 2 * content->getFrameSize(); graphics->pushClipArea(rec); - content->drawBorder(graphics); + content->drawFrame(graphics); graphics->popClipArea(); } @@ -223,9 +223,9 @@ void ScrollArea::draw(gcn::Graphics *graphics) } } -void ScrollArea::drawBorder(gcn::Graphics *graphics) +void ScrollArea::drawFrame(gcn::Graphics *graphics) { - int bs = getBorderSize(); + int bs = getFrameSize(); int w = getWidth() + bs * 2; int h = getHeight() + bs * 2; @@ -240,10 +240,10 @@ void ScrollArea::setOpaque(bool opaque) mOpaque = opaque; if (mOpaque) { - setBorderSize(2); + setFrameSize(2); } else { - setBorderSize(0); + setFrameSize(0); } } diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h index 504842cc..9fb7093d 100644 --- a/src/gui/scrollarea.h +++ b/src/gui/scrollarea.h @@ -65,7 +65,7 @@ class ScrollArea : public gcn::ScrollArea { /** * Draws the background and border of the scroll area. */ - void drawBorder(gcn::Graphics *graphics); + void drawFrame(gcn::Graphics *graphics); /** * Sets whether the widget should draw its background or not. diff --git a/src/gui/selectionlistener.h b/src/gui/selectionlistener.h deleted file mode 100644 index 917a4871..00000000 --- a/src/gui/selectionlistener.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#ifndef _TMW_SELECTIONLISTENER_H__ -#define _TMW_SELECTIONLISTENER_H__ - -#include -#include - -/** - * An event that characterizes a change in the current selection. - * - * \ingroup GUI - */ -class SelectionEvent : public gcn::Event -{ - public: - /** - * Constructor. - */ - SelectionEvent(gcn::Widget *source): - gcn::Event(source) - { - } -}; - -/** - * The listener that's notified when a selection value changes. - * - * \ingroup GUI - */ -class SelectionListener -{ - public: - /** - * Virtual destructor. - */ - virtual ~SelectionListener() {} - - /** - * Called whenever the value of the selection changes. - */ - virtual void selectionChanged(const SelectionEvent &event) = 0; -}; - -typedef std::list SelectionListeners; - -#endif diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index bc683c0b..e101ad39 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -182,7 +182,7 @@ void SellDialog::action(const gcn::ActionEvent &event) } } -void SellDialog::selectionChanged(const SelectionEvent &event) +void SellDialog::valueChanged(const gcn::SelectionEvent &event) { // Reset amount of items and update labels mAmountItems = 1; diff --git a/src/gui/sell.h b/src/gui/sell.h index cde862d5..63a16770 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.h @@ -25,10 +25,9 @@ #define _TMW_SELL_H #include +#include #include "window.h" -#include "selectionlistener.h" -#include "windowlistener.h" #include "../guichanfwd.h" @@ -41,7 +40,7 @@ class ShopListBox; * * \ingroup Interface */ -class SellDialog : public Window, gcn::ActionListener, SelectionListener +class SellDialog : public Window, gcn::ActionListener, gcn::SelectionListener { public: /** @@ -76,7 +75,7 @@ class SellDialog : public Window, gcn::ActionListener, SelectionListener * * @see SelectionListener::selectionChanged */ - void selectionChanged(const SelectionEvent &event); + void valueChanged(const gcn::SelectionEvent &event); /** * Gives Player's Money amount diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index 89c21e2b..a02b3c20 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -72,7 +72,7 @@ Setup_Audio::Setup_Audio(): void Setup_Audio::apply() { - if (mSoundCheckBox->isMarked()) + if (mSoundCheckBox->isSelected()) { config.setValue("sound", 1); try { @@ -97,7 +97,7 @@ void Setup_Audio::apply() void Setup_Audio::cancel() { - mSoundCheckBox->setMarked(mSoundEnabled); + mSoundCheckBox->setSelected(mSoundEnabled); sound.setSfxVolume(mSfxVolume); mSfxSlider->setValue(mSfxVolume); diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp index 59cfefa4..dfa446ab 100644 --- a/src/gui/setup_joystick.cpp +++ b/src/gui/setup_joystick.cpp @@ -45,7 +45,7 @@ Setup_Joystick::Setup_Joystick(): mCalibrateButton->setPosition(10, 30 + mCalibrateLabel->getHeight()); mOriginalJoystickEnabled = (int)config.getValue("joystickEnabled", 0) != 0; - mJoystickEnabled->setMarked(mOriginalJoystickEnabled); + mJoystickEnabled->setSelected(mOriginalJoystickEnabled); mJoystickEnabled->addActionListener(this); @@ -62,7 +62,7 @@ void Setup_Joystick::action(const gcn::ActionEvent &event) if (event.getSource() == mJoystickEnabled) { - joystick->setEnabled(mJoystickEnabled->isMarked()); + joystick->setEnabled(mJoystickEnabled->isSelected()); } else { @@ -85,7 +85,7 @@ void Setup_Joystick::cancel() { joystick->setEnabled(mOriginalJoystickEnabled); } - mJoystickEnabled->setMarked(mOriginalJoystickEnabled); + mJoystickEnabled->setSelected(mOriginalJoystickEnabled); } void Setup_Joystick::apply() diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index ee46396b..fcdb6c51 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -157,7 +157,7 @@ Setup_Video::Setup_Video(): mFpsField->setEnabled(mFps > 0); mFpsSlider->setValue(mFps); mFpsSlider->setEnabled(mFps > 0); - mFpsCheckBox->setMarked(mFps > 0); + mFpsCheckBox->setSelected(mFps > 0); mCustomCursorCheckBox->setActionEventId("customcursor"); mAlphaSlider->setActionEventId("guialpha"); @@ -245,7 +245,7 @@ Setup_Video::~Setup_Video() void Setup_Video::apply() { // Full screen changes - bool fullscreen = mFsCheckBox->isMarked(); + bool fullscreen = mFsCheckBox->isSelected(); if (fullscreen != (config.getValue("screen", 0) == 1)) { // checks for opengl usage @@ -272,9 +272,9 @@ void Setup_Video::apply() } // OpenGL change - if (mOpenGLCheckBox->isMarked() != mOpenGLEnabled) + if (mOpenGLCheckBox->isSelected() != mOpenGLEnabled) { - config.setValue("opengl", mOpenGLCheckBox->isMarked() ? 1 : 0); + config.setValue("opengl", mOpenGLCheckBox->isSelected() ? 1 : 0); // OpenGL can currently only be changed by restarting, notify user. new OkDialog(_("Changing OpenGL"), @@ -315,9 +315,9 @@ Setup_Video::updateSlider(gcn::Slider *slider, gcn::TextField *field, void Setup_Video::cancel() { - mFsCheckBox->setMarked(mFullScreenEnabled); - mOpenGLCheckBox->setMarked(mOpenGLEnabled); - mCustomCursorCheckBox->setMarked(mCustomCursorEnabled); + mFsCheckBox->setSelected(mFullScreenEnabled); + mOpenGLCheckBox->setSelected(mOpenGLEnabled); + mCustomCursorCheckBox->setSelected(mCustomCursorEnabled); mAlphaSlider->setValue(mOpacity); mOverlayDetailSlider->setValue(mOverlayDetail); @@ -341,7 +341,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) else if (event.getId() == "customcursor") { config.setValue("customcursor", - mCustomCursorCheckBox->isMarked() ? 1 : 0); + mCustomCursorCheckBox->isSelected() ? 1 : 0); } else if (event.getId() == "fpslimitslider") { @@ -379,7 +379,7 @@ void Setup_Video::action(const gcn::ActionEvent &event) } else if (event.getId() == "fpslimitcheckbox") { - if (mFpsCheckBox->isMarked()) + if (mFpsCheckBox->isSelected()) { mFps = (int) mFpsSlider->getValue(); } diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index e6d3c516..ba77be47 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -23,8 +23,6 @@ #include "shoplistbox.h" -#include "selectionlistener.h" - #include #include #include @@ -101,37 +99,12 @@ void ShopListBox::draw(gcn::Graphics *gcnGraphics) } } -void ShopListBox::setSelected(int selected) -{ - if (!mListModel) - { - mSelected = -1; - } - else - { - // Update mSelected with bounds checking - mSelected = std::min(mListModel->getNumberOfElements() - 1, - std::max(-1, selected)); - - gcn::Widget *parent = getParent(); - if (parent && mSelected >= 0) - { - gcn::Rectangle scroll; - scroll.y = mRowHeight * mSelected; - scroll.height = mRowHeight; - parent->showWidgetPart(this, scroll); - } - } - - fireSelectionChangedEvent(); -} - void ShopListBox::mousePressed(gcn::MouseEvent &event) { if (event.getButton() == gcn::MouseEvent::LEFT) { setSelected(event.getY() / mRowHeight); - generateAction(); + distributeActionEvent(); } } diff --git a/src/gui/shoplistbox.h b/src/gui/shoplistbox.h index 44a68445..d5e2d836 100644 --- a/src/gui/shoplistbox.h +++ b/src/gui/shoplistbox.h @@ -27,8 +27,6 @@ #include "listbox.h" #include "shop.h" -class SelectionListener; - /** * A list box, meant to be used inside a scroll area. Same as the Guichan list * box except this one doesn't have a background, instead completely relying @@ -54,30 +52,12 @@ class ShopListBox : public ListBox */ void draw(gcn::Graphics *graphics); - void mousePressed(gcn::MouseEvent &event); - /** - * Adds a listener to the list that's notified each time a change to - * the selection occurs. + * Returns the height of a row. */ - void addSelectionListener(SelectionListener *listener) - { - mListeners.push_back(listener); - } + unsigned int getRowHeight() const { return mRowHeight; } - /** - * Removes a listener from the list that's notified each time a change - * to the selection occurs. - */ - void removeSelectionListener(SelectionListener *listener) - { - mListeners.remove(listener); - } - - /** - * Sets the index of the selected element. - */ - void setSelected(int selected); + void mousePressed(gcn::MouseEvent &event); /** * gives information about the current player's money @@ -104,7 +84,7 @@ class ShopListBox : public ListBox */ ShopItems *mShopItems; - int mRowHeight; /**< Row Height */ + unsigned int mRowHeight; /**< Row Height */ bool mPriceCheck; }; diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp index f0170a1b..c94c7bfb 100644 --- a/src/gui/slider.cpp +++ b/src/gui/slider.cpp @@ -64,7 +64,7 @@ Slider::~Slider() void Slider::init() { int x, y, w, h,o1,o2; - setBorderSize(0); + setFrameSize(0); // Load resources if (mInstances == 0) diff --git a/src/gui/tabbedcontainer.cpp b/src/gui/tabbedcontainer.cpp index 8fb2f598..d6267e65 100644 --- a/src/gui/tabbedcontainer.cpp +++ b/src/gui/tabbedcontainer.cpp @@ -82,8 +82,8 @@ void TabbedContainer::logic() { if (mActiveContent) { mActiveContent->setSize( - getWidth() - 2 * mActiveContent->getBorderSize(), - getHeight() - TABHEIGHT - 2 * mActiveContent->getBorderSize()); + getWidth() - 2 * mActiveContent->getFrameSize(), + getHeight() - TABHEIGHT - 2 * mActiveContent->getFrameSize()); } Container::logic(); diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp index 329813e5..84c8ad4b 100644 --- a/src/gui/textbox.cpp +++ b/src/gui/textbox.cpp @@ -32,14 +32,14 @@ TextBox::TextBox(): gcn::TextBox() { setOpaque(false); - setBorderSize(0); + setFrameSize(0); } TextBox::TextBox(const std::string& text): gcn::TextBox(text) { setOpaque(false); - setBorderSize(0); + setFrameSize(0); } void TextBox::setText(const std::string &text) diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp index 11659b8b..4fd85d36 100644 --- a/src/gui/textfield.cpp +++ b/src/gui/textfield.cpp @@ -44,7 +44,7 @@ ImageRect TextField::skin; TextField::TextField(const std::string& text): gcn::TextField(text) { - setBorderSize(2); + setFrameSize(2); if (instances == 0) { @@ -97,10 +97,10 @@ void TextField::draw(gcn::Graphics *graphics) graphics->drawText(mText, 1 - mXScroll, 1); } -void TextField::drawBorder(gcn::Graphics *graphics) +void TextField::drawFrame(gcn::Graphics *graphics) { int w, h, bs; - bs = getBorderSize(); + bs = getFrameSize(); w = getWidth() + bs * 2; h = getHeight() + bs * 2; @@ -184,7 +184,7 @@ void TextField::keyPressed(gcn::KeyEvent &keyEvent) } break; case Key::ENTER: - generateAction(); + distributeActionEvent(); break; case Key::HOME: diff --git a/src/gui/textfield.h b/src/gui/textfield.h index e36380e3..36f921ac 100644 --- a/src/gui/textfield.h +++ b/src/gui/textfield.h @@ -53,7 +53,7 @@ class TextField : public gcn::TextField { /** * Draws the background and border. */ - void drawBorder(gcn::Graphics *graphics); + void drawFrame(gcn::Graphics *graphics); /** * Processes one keypress. diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index bb3d702f..c098c04c 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -147,7 +147,7 @@ void TradeWindow::tradeItem(Item *item, int quantity) item->increaseQuantity(-quantity); } -void TradeWindow::selectionChanged(const SelectionEvent &event) +void TradeWindow::valueChanged(const gcn::SelectionEvent &event) { Item *item; diff --git a/src/gui/trade.h b/src/gui/trade.h index 449de573..c8ece8d9 100644 --- a/src/gui/trade.h +++ b/src/gui/trade.h @@ -25,9 +25,9 @@ #define _TMW_TRADE_H #include +#include #include "window.h" -#include "selectionlistener.h" #include "../guichanfwd.h" @@ -41,7 +41,7 @@ class ScrollArea; * * \ingroup Interface */ -class TradeWindow : public Window, gcn::ActionListener, SelectionListener +class TradeWindow : public Window, gcn::ActionListener, gcn::SelectionListener { public: /** @@ -84,7 +84,7 @@ class TradeWindow : public Window, gcn::ActionListener, SelectionListener * Updates the labels and makes sure only one item is selected in * either my inventory or partner inventory. */ - void selectionChanged(const SelectionEvent &event); + void valueChanged(const gcn::SelectionEvent &event); /** * Called when receiving actions from the widgets. diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index 6863aa01..b33a55cf 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -42,7 +42,7 @@ DropDown::DropDown(gcn::ListModel *listModel, gcn::DropDown::DropDown(listModel, scrollArea, listBox) { - setBorderSize(2); + setFrameSize(2); // Initialize graphics if (instances == 0) @@ -103,7 +103,7 @@ void DropDown::draw(gcn::Graphics* graphics) if (mDroppedDown) { - h = mOldH; + h = mFoldedUpHeight; } else { @@ -151,19 +151,18 @@ void DropDown::draw(gcn::Graphics* graphics) } } -void DropDown::drawBorder(gcn::Graphics *graphics) +void DropDown::drawFrame(gcn::Graphics *graphics) { - int w, h, bs; - bs = getBorderSize(); - w = getWidth() + bs * 2; - h = getHeight() + bs * 2; + const int bs = getFrameSize(); + const int w = getWidth() + bs * 2; + const int h = getHeight() + bs * 2; static_cast(graphics)->drawImageRect(0, 0, w, h, skin); } void DropDown::drawButton(gcn::Graphics *graphics) { - int height = mDroppedDown ? mOldH : getHeight(); + int height = mDroppedDown ? mFoldedUpHeight : getHeight(); static_cast(graphics)-> drawImage(buttons[mDroppedDown][mPushed], getWidth() - height, 1); diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index 37e754af..d0dab7d2 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -64,7 +64,7 @@ class DropDown : public gcn::DropDown void draw(gcn::Graphics* graphics); - void drawBorder(gcn::Graphics* graphics); + void drawFrame(gcn::Graphics* graphics); protected: diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 7629e2e7..75288eb5 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -106,7 +106,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent): instances++; - setBorderSize(0); + setFrameSize(0); setPadding(3); setTitleBarHeight(20); @@ -121,6 +121,8 @@ Window::Window(const std::string& caption, bool modal, Window *parent): // Windows are invisible by default setVisible(false); + + addWidgetListener(this); } Window::~Window() @@ -202,84 +204,12 @@ void Window::draw(gcn::Graphics *graphics) drawChildren(graphics); } -void Window::setContentWidth(int width) -{ - setWidth(width + 2 * getPadding()); -} - -void Window::setContentHeight(int height) -{ - setHeight(height + getPadding() + getTitleBarHeight()); -} - void Window::setContentSize(int width, int height) { setSize(width + 2 * getPadding(), height + getPadding() + getTitleBarHeight()); } -void Window::setSize(int width, int height) -{ - if (width == mDimension.width && height == mDimension.height) return; - - // No call to ancestor! Infinite loop otherwise. - mDimension.width = width; - mDimension.height = height; - - if (mGrip) - { - gcn::Rectangle const &area = getChildrenArea(); - mGrip->setPosition(width - mGrip->getWidth() - area.x, - height - mGrip->getHeight() - area.y); - } - - if (mLayout) - { - int w = width - 2 * getPadding(), - h = height - getPadding() - getTitleBarHeight(); - mLayout->reflow(w, h); - } - - fireWindowEvent(WindowEvent(this, WindowEvent::WINDOW_RESIZED)); -} - -void Window::setWidth(int width) -{ - setSize(width, mDimension.height); -} - -void Window::setHeight(int height) -{ - setSize(mDimension.width, height); -} - -void Window::setPosition(int x, int y) -{ - if (x == mDimension.x && y == mDimension.y) return; - - // No call to ancestor! - mDimension.x = x; - mDimension.y = y; - - fireWindowEvent(WindowEvent(this, WindowEvent::WINDOW_MOVED)); -} - -void Window::setDimension(const gcn::Rectangle &dimension) -{ - setPosition(dimension.x, dimension.y); - setSize(dimension.width, dimension.height); -} - -void Window::setX(int x) -{ - setPosition(x, mDimension.y); -} - -void Window::setY(int y) -{ - setPosition(mDimension.x, y); -} - void Window::setLocationRelativeTo(gcn::Widget *widget) { int wx, wy; @@ -331,6 +261,23 @@ void Window::setResizable(bool r) } } +void Window::widgetResized(const gcn::Event &event) +{ + if (mGrip) + { + gcn::Rectangle const &area = getChildrenArea(); + mGrip->setPosition(getWidth() - mGrip->getWidth() - area.x, + getHeight() - mGrip->getHeight() - area.y); + } + + if (mLayout) + { + int w = getWidth() - 2 * getPadding(); + int h = getHeight() - getPadding() - getTitleBarHeight(); + mLayout->reflow(w, h); + } +} + void Window::setCloseButton(bool flag) { mCloseButton = flag; @@ -407,7 +354,7 @@ void Window::mouseReleased(gcn::MouseEvent &event) } // This should be the responsibility of Guichan (and is from 0.8.0 on) - mIsMoving = false; + mMoved = false; } void Window::mouseExited(gcn::MouseEvent &event) @@ -449,7 +396,7 @@ void Window::mouseDragged(gcn::MouseEvent &event) gcn::Window::mouseDragged(event); // Keep guichan window inside screen when it may be moved - if (isMovable() && mIsMoving) + if (isMovable() && mMoved) { int newX = std::max(0, getX()); int newY = std::max(0, getY()); @@ -458,7 +405,7 @@ void Window::mouseDragged(gcn::MouseEvent &event) setPosition(newX, newY); } - if (mouseResize && !mIsMoving) + if (mouseResize && !mMoved) { const int dx = event.getX() - mDragOffsetX; const int dy = event.getY() - mDragOffsetY; @@ -585,24 +532,6 @@ int Window::getResizeHandles(gcn::MouseEvent &event) return resizeHandles; } -void Window::fireWindowEvent(const WindowEvent &event) -{ - WindowListeners::iterator i_end = mListeners.end(); - WindowListeners::iterator i = mListeners.begin(); - - switch (event.getType()) - { - case WindowEvent::WINDOW_MOVED: - for (; i != i_end; ++i) - { (*i)->windowMoved(event); } - break; - case WindowEvent::WINDOW_RESIZED: - for (; i != i_end; ++i) - { (*i)->windowResized(event); } - break; - } -} - Layout &Window::getLayout() { if (!mLayout) mLayout = new Layout; diff --git a/src/gui/window.h b/src/gui/window.h index df756be3..9f5969f0 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -25,11 +25,10 @@ #define _TMW_WINDOW_H__ #include +#include #include "../guichanfwd.h" -#include "windowlistener.h" - class ConfigListener; class ContainerPlacer; class Image; @@ -45,7 +44,7 @@ class WindowContainer; * * \ingroup GUI */ -class Window : public gcn::Window +class Window : public gcn::Window, gcn::WidgetListener { public: friend class WindowConfigListener; @@ -78,56 +77,11 @@ class Window : public gcn::Window */ void draw(gcn::Graphics *graphics); - /** - * Sets the width of the window contents. - */ - void setContentWidth(int width); - - /** - * Sets the height of the window contents. - */ - void setContentHeight(int height); - /** * Sets the size of this window. */ void setContentSize(int width, int height); - /** - * Sets the size of this window. - */ - void setSize(int width, int height); - - /** - * Sets the width of this window. - */ - void setWidth(int width); - - /** - * Sets the height of this window. - */ - void setHeight(int height); - - /** - * Sets the position and size of this window. - */ - void setDimension(const gcn::Rectangle &dimension); - - /** - * Sets the position of this window. - */ - void setPosition(int x, int y); - - /** - * Sets the window x coordinate. - */ - void setX(int x); - - /** - * Sets the window y coordinate. - */ - void setY(int y); - /** * Sets the location relative to the given widget. */ @@ -138,6 +92,11 @@ class Window : public gcn::Window */ void setResizable(bool resize); + /** + * Called whenever the widget changes size. + */ + void widgetResized(const gcn::Event &event); + /** * Sets whether or not the window has a close button. */ @@ -256,20 +215,6 @@ class Window : public gcn::Window */ void resetToDefaultSize(); - /** - * Adds a listener to the list that's notified when the window is - * moved or resized. - */ - void addWindowListener(WindowListener *listener) - { mListeners.push_back(listener); } - - /** - * Removes a listener from the list that's notified when the window is - * moved or resized. - */ - void removeWindowListener(WindowListener *listener) - { mListeners.remove(listener); } - enum ResizeHandles { TOP = 0x01, @@ -349,14 +294,6 @@ class Window : public gcn::Window * where two borders are moved at the same time. */ static const int resizeBorderWidth = 10; - - private: - /** - * Sends out a window event to the list of selection listeners. - */ - void fireWindowEvent(const WindowEvent &event); - - WindowListeners mListeners; }; #endif diff --git a/src/gui/windowlistener.h b/src/gui/windowlistener.h deleted file mode 100644 index 24f6a7b8..00000000 --- a/src/gui/windowlistener.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * The Mana World - * Copyright 2004 The Mana World Development Team - * - * This file is part of The Mana World. - * - * The Mana World is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * The Mana World is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with The Mana World; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - * $Id$ - */ - -#ifndef _TMW_WINDOW_LISTENER_H_ -#define _TMW_WINDOW_LISTENER_H_ - -#include -#include - -/** - * An event that characterizes a window move or resize. - * - * \ingroup GUI - */ -class WindowEvent : public gcn::Event -{ - public: - /** - * Constructor. - */ - WindowEvent(gcn::Window *source, int type): - gcn::Event(source) - { - mType = type; - } - - /** - * Returns the event type. - */ - int getType() const - { return mType; } - - enum WindowEventType - { - WINDOW_MOVED, - WINDOW_RESIZED - }; -}; - -/** - * The listener that's notified when a window is moved or resized. - * - * \ingroup GUI - */ -class WindowListener -{ - public: - /** - * Virtual destructor. - */ - virtual ~WindowListener() {} - - /** - * Called whenever the window is moved. - */ - virtual void windowMoved(const WindowEvent &) {} - - /** - * Called whenever the window is resized. - */ - virtual void windowResized(const WindowEvent &) {} -}; - -typedef std::list WindowListeners; - -#endif -- cgit v1.2.3-70-g09d2 From ff61662640c4053220464f34413568f06f51154a Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Sun, 16 Nov 2008 15:37:13 +0100 Subject: Got rid of CVS/Subversion $Id$ markers I don't know why we dealt with these things for so long. Did we ever get anything out of it? --- src/animatedsprite.cpp | 2 -- src/animatedsprite.h | 2 -- src/animationparticle.cpp | 1 - src/animationparticle.h | 1 - src/being.cpp | 2 -- src/being.h | 2 -- src/beingmanager.cpp | 2 -- src/beingmanager.h | 2 -- src/channel.cpp | 2 -- src/channel.h | 2 -- src/channelmanager.cpp | 2 -- src/channelmanager.h | 2 -- src/commandhandler.cpp | 2 -- src/commandhandler.h | 2 -- src/configlistener.h | 2 -- src/configuration.cpp | 2 -- src/configuration.h | 2 -- src/effectmanager.cpp | 1 - src/effectmanager.h | 1 - src/engine.cpp | 2 -- src/engine.h | 2 -- src/equipment.cpp | 2 -- src/equipment.h | 2 -- src/floor_item.cpp | 2 -- src/floor_item.h | 2 -- src/flooritemmanager.cpp | 2 -- src/flooritemmanager.h | 2 -- src/game.cpp | 2 -- src/game.h | 2 -- src/graphics.cpp | 2 -- src/graphics.h | 2 -- src/gui/box.cpp | 2 -- src/gui/box.h | 2 -- src/gui/browserbox.cpp | 2 -- src/gui/browserbox.h | 2 -- src/gui/buddywindow.cpp | 2 -- src/gui/buddywindow.h | 2 -- src/gui/button.cpp | 2 -- src/gui/button.h | 2 -- src/gui/buy.cpp | 2 -- src/gui/buy.h | 2 -- src/gui/buysell.cpp | 2 -- src/gui/buysell.h | 2 -- src/gui/changeemaildialog.cpp | 2 -- src/gui/changeemaildialog.h | 2 -- src/gui/changepassworddialog.cpp | 2 -- src/gui/changepassworddialog.h | 2 -- src/gui/char_select.cpp | 2 -- src/gui/char_select.h | 2 -- src/gui/chargedialog.cpp | 1 - src/gui/chargedialog.h | 1 - src/gui/chat.cpp | 2 -- src/gui/chat.h | 2 -- src/gui/chatinput.cpp | 2 -- src/gui/chatinput.h | 2 -- src/gui/checkbox.cpp | 2 -- src/gui/checkbox.h | 2 -- src/gui/confirm_dialog.cpp | 2 -- src/gui/confirm_dialog.h | 2 -- src/gui/connection.cpp | 2 -- src/gui/connection.h | 2 -- src/gui/debugwindow.cpp | 2 -- src/gui/debugwindow.h | 2 -- src/gui/equipmentwindow.cpp | 2 -- src/gui/equipmentwindow.h | 2 -- src/gui/focushandler.cpp | 2 -- src/gui/focushandler.h | 2 -- src/gui/gccontainer.cpp | 2 -- src/gui/gccontainer.h | 2 -- src/gui/gui.cpp | 2 -- src/gui/gui.h | 2 -- src/gui/guildlistbox.cpp | 2 -- src/gui/guildlistbox.h | 2 -- src/gui/guildwindow.cpp | 1 - src/gui/guildwindow.h | 2 -- src/gui/hbox.cpp | 2 -- src/gui/hbox.h | 2 -- src/gui/help.cpp | 2 -- src/gui/help.h | 2 -- src/gui/icon.cpp | 2 -- src/gui/icon.h | 2 -- src/gui/inttextbox.cpp | 2 -- src/gui/inttextbox.h | 2 -- src/gui/inventorywindow.cpp | 2 -- src/gui/inventorywindow.h | 2 -- src/gui/item_amount.cpp | 2 -- src/gui/item_amount.h | 2 -- src/gui/itemcontainer.cpp | 2 -- src/gui/itemcontainer.h | 2 -- src/gui/itempopup.cpp | 2 -- src/gui/itempopup.h | 3 --- src/gui/itemshortcutcontainer.cpp | 2 -- src/gui/itemshortcutcontainer.h | 2 -- src/gui/itemshortcutwindow.cpp | 2 -- src/gui/itemshortcutwindow.h | 2 -- src/gui/linkhandler.h | 2 -- src/gui/listbox.cpp | 2 -- src/gui/listbox.h | 2 -- src/gui/login.cpp | 2 -- src/gui/login.h | 2 -- src/gui/magic.cpp | 2 -- src/gui/magic.h | 3 --- src/gui/menuwindow.cpp | 2 -- src/gui/menuwindow.h | 2 -- src/gui/minimap.cpp | 2 -- src/gui/minimap.h | 2 -- src/gui/ministatus.cpp | 2 -- src/gui/ministatus.h | 2 -- src/gui/newskill.cpp | 2 -- src/gui/newskill.h | 2 -- src/gui/npc_text.cpp | 2 -- src/gui/npc_text.h | 2 -- src/gui/npclistdialog.cpp | 2 -- src/gui/npclistdialog.h | 2 -- src/gui/npcpostdialog.cpp | 2 -- src/gui/npcpostdialog.h | 2 -- src/gui/ok_dialog.cpp | 2 -- src/gui/ok_dialog.h | 2 -- src/gui/partywindow.cpp | 2 -- src/gui/partywindow.h | 2 -- src/gui/passwordfield.cpp | 2 -- src/gui/passwordfield.h | 2 -- src/gui/playerbox.cpp | 2 -- src/gui/playerbox.h | 2 -- src/gui/popupmenu.cpp | 2 -- src/gui/popupmenu.h | 2 -- src/gui/progressbar.cpp | 2 -- src/gui/progressbar.h | 2 -- src/gui/quitdialog.cpp | 1 - src/gui/quitdialog.h | 1 - src/gui/radiobutton.cpp | 2 -- src/gui/radiobutton.h | 2 -- src/gui/register.cpp | 2 -- src/gui/register.h | 2 -- src/gui/scrollarea.cpp | 2 -- src/gui/scrollarea.h | 2 -- src/gui/sdlinput.cpp | 2 -- src/gui/sdlinput.h | 2 -- src/gui/sell.cpp | 2 -- src/gui/sell.h | 2 -- src/gui/serverdialog.cpp | 2 -- src/gui/serverdialog.h | 2 -- src/gui/setup.cpp | 2 -- src/gui/setup.h | 2 -- src/gui/setup_audio.cpp | 2 -- src/gui/setup_audio.h | 2 -- src/gui/setup_joystick.cpp | 2 -- src/gui/setup_joystick.h | 2 -- src/gui/setup_keyboard.cpp | 2 -- src/gui/setup_keyboard.h | 2 -- src/gui/setup_video.cpp | 2 -- src/gui/setup_video.h | 2 -- src/gui/setuptab.h | 2 -- src/gui/shop.cpp | 2 -- src/gui/shop.h | 2 -- src/gui/shoplistbox.cpp | 2 -- src/gui/shoplistbox.h | 2 -- src/gui/skill.cpp | 2 -- src/gui/skill.h | 2 -- src/gui/slider.cpp | 2 -- src/gui/slider.h | 2 -- src/gui/speechbubble.cpp | 2 -- src/gui/speechbubble.h | 2 -- src/gui/status.cpp | 2 -- src/gui/status.h | 2 -- src/gui/textbox.cpp | 2 -- src/gui/textbox.h | 2 -- src/gui/textdialog.cpp | 2 -- src/gui/textdialog.h | 2 -- src/gui/textfield.cpp | 2 -- src/gui/textfield.h | 2 -- src/gui/trade.cpp | 2 -- src/gui/trade.h | 2 -- src/gui/truetypefont.cpp | 2 -- src/gui/truetypefont.h | 2 -- src/gui/unregisterdialog.cpp | 2 -- src/gui/unregisterdialog.h | 2 -- src/gui/updatewindow.cpp | 2 -- src/gui/updatewindow.h | 2 -- src/gui/vbox.cpp | 2 -- src/gui/vbox.h | 2 -- src/gui/viewport.cpp | 2 -- src/gui/viewport.h | 2 -- src/gui/widgets/avatar.cpp | 2 -- src/gui/widgets/avatar.h | 2 -- src/gui/widgets/dropdown.cpp | 2 -- src/gui/widgets/dropdown.h | 2 -- src/gui/widgets/layout.cpp | 2 -- src/gui/widgets/layout.h | 2 -- src/gui/widgets/resizegrip.cpp | 2 -- src/gui/widgets/resizegrip.h | 2 -- src/gui/widgets/tab.cpp | 2 -- src/gui/widgets/tab.h | 2 -- src/gui/widgets/tabbedarea.cpp | 2 -- src/gui/widgets/tabbedarea.h | 2 -- src/gui/window.cpp | 2 -- src/gui/window.h | 2 -- src/gui/windowcontainer.cpp | 2 -- src/gui/windowcontainer.h | 2 -- src/guichanfwd.h | 2 -- src/guild.cpp | 2 -- src/guild.h | 2 -- src/imageparticle.cpp | 2 -- src/imageparticle.h | 2 -- src/inventory.cpp | 2 -- src/inventory.h | 2 -- src/item.cpp | 2 -- src/item.h | 2 -- src/itemshortcut.cpp | 2 -- src/itemshortcut.h | 2 -- src/joystick.cpp | 2 -- src/joystick.h | 2 -- src/keyboardconfig.cpp | 2 -- src/keyboardconfig.h | 2 -- src/localplayer.cpp | 2 -- src/localplayer.h | 2 -- src/lockedarray.h | 2 -- src/logindata.h | 2 -- src/main.cpp | 2 -- src/main.h | 2 -- src/map.cpp | 2 -- src/map.h | 2 -- src/monster.cpp | 2 -- src/monster.h | 2 -- src/net/accountserver/account.cpp | 2 -- src/net/accountserver/account.h | 2 -- src/net/accountserver/accountserver.cpp | 2 -- src/net/accountserver/accountserver.h | 2 -- src/net/accountserver/internal.cpp | 2 -- src/net/accountserver/internal.h | 2 -- src/net/beinghandler.cpp | 2 -- src/net/beinghandler.h | 2 -- src/net/buysellhandler.cpp | 2 -- src/net/buysellhandler.h | 2 -- src/net/charserverhandler.cpp | 2 -- src/net/charserverhandler.h | 2 -- src/net/chathandler.cpp | 2 -- src/net/chathandler.h | 2 -- src/net/chatserver/chatserver.cpp | 2 -- src/net/chatserver/chatserver.h | 2 -- src/net/chatserver/guild.cpp | 2 -- src/net/chatserver/guild.h | 2 -- src/net/chatserver/internal.cpp | 2 -- src/net/chatserver/internal.h | 2 -- src/net/chatserver/party.cpp | 2 -- src/net/chatserver/party.h | 2 -- src/net/connection.cpp | 2 -- src/net/connection.h | 2 -- src/net/effecthandler.cpp | 1 - src/net/effecthandler.h | 1 - src/net/gameserver/gameserver.cpp | 2 -- src/net/gameserver/gameserver.h | 2 -- src/net/gameserver/internal.cpp | 2 -- src/net/gameserver/internal.h | 2 -- src/net/gameserver/player.cpp | 2 -- src/net/gameserver/player.h | 2 -- src/net/guildhandler.cpp | 2 -- src/net/guildhandler.h | 2 -- src/net/internal.cpp | 2 -- src/net/internal.h | 2 -- src/net/inventoryhandler.cpp | 2 -- src/net/inventoryhandler.h | 2 -- src/net/itemhandler.cpp | 2 -- src/net/itemhandler.h | 2 -- src/net/loginhandler.cpp | 2 -- src/net/loginhandler.h | 2 -- src/net/logouthandler.cpp | 2 -- src/net/logouthandler.h | 2 -- src/net/messagehandler.cpp | 2 -- src/net/messagehandler.h | 2 -- src/net/messagein.cpp | 2 -- src/net/messagein.h | 2 -- src/net/messageout.cpp | 2 -- src/net/messageout.h | 2 -- src/net/network.cpp | 2 -- src/net/network.h | 2 -- src/net/npchandler.cpp | 2 -- src/net/npchandler.h | 2 -- src/net/partyhandler.cpp | 2 -- src/net/partyhandler.h | 2 -- src/net/playerhandler.cpp | 2 -- src/net/playerhandler.h | 2 -- src/net/protocol.h | 2 -- src/net/tradehandler.cpp | 2 -- src/net/tradehandler.h | 2 -- src/npc.cpp | 2 -- src/npc.h | 2 -- src/openglgraphics.cpp | 2 -- src/openglgraphics.h | 2 -- src/particle.cpp | 2 -- src/particle.h | 2 -- src/particleemitter.cpp | 2 -- src/particleemitter.h | 2 -- src/player.cpp | 2 -- src/player.h | 2 -- src/position.cpp | 2 -- src/position.h | 2 -- src/properties.h | 2 -- src/resources/action.cpp | 2 -- src/resources/action.h | 2 -- src/resources/ambientoverlay.cpp | 2 -- src/resources/ambientoverlay.h | 2 -- src/resources/animation.cpp | 2 -- src/resources/animation.h | 2 -- src/resources/buddylist.cpp | 2 -- src/resources/buddylist.h | 2 -- src/resources/dye.cpp | 2 -- src/resources/dye.h | 2 -- src/resources/image.cpp | 2 -- src/resources/image.h | 2 -- src/resources/imageloader.cpp | 2 -- src/resources/imageloader.h | 2 -- src/resources/imageset.cpp | 2 -- src/resources/imageset.h | 2 -- src/resources/imagewriter.cpp | 2 -- src/resources/imagewriter.h | 2 -- src/resources/itemdb.cpp | 2 -- src/resources/itemdb.h | 2 -- src/resources/iteminfo.cpp | 2 -- src/resources/iteminfo.h | 2 -- src/resources/mapreader.cpp | 2 -- src/resources/mapreader.h | 2 -- src/resources/monsterdb.cpp | 2 -- src/resources/monsterdb.h | 2 -- src/resources/monsterinfo.cpp | 2 -- src/resources/monsterinfo.h | 2 -- src/resources/music.cpp | 2 -- src/resources/music.h | 2 -- src/resources/npcdb.cpp | 2 -- src/resources/npcdb.h | 2 -- src/resources/resource.cpp | 2 -- src/resources/resource.h | 2 -- src/resources/resourcemanager.cpp | 2 -- src/resources/resourcemanager.h | 2 -- src/resources/soundeffect.cpp | 2 -- src/resources/soundeffect.h | 2 -- src/resources/spritedef.cpp | 2 -- src/resources/spritedef.h | 2 -- src/serverinfo.h | 2 -- src/shopitem.cpp | 2 -- src/shopitem.h | 2 -- src/simpleanimation.cpp | 2 -- src/simpleanimation.h | 2 -- src/sound.cpp | 2 -- src/sound.h | 2 -- src/sprite.h | 2 -- src/textparticle.cpp | 2 -- src/textparticle.h | 2 -- src/tileset.h | 2 -- src/utils/base64.cpp | 1 - src/utils/base64.h | 1 - src/utils/dtor.h | 2 -- src/utils/fastsqrt.h | 2 -- src/utils/gettext.h | 2 -- src/utils/minmax.h | 2 -- src/utils/sha256.cpp | 2 -- src/utils/sha256.h | 2 -- src/utils/strprintf.cpp | 2 -- src/utils/strprintf.h | 2 -- src/utils/tostring.h | 2 -- src/utils/trim.h | 2 -- src/utils/xml.cpp | 2 -- src/utils/xml.h | 2 -- src/vector.cpp | 2 -- src/vector.h | 2 -- tools/dyecmd/src/dye.cpp | 2 -- tools/dyecmd/src/dye.h | 2 -- tools/dyecmd/src/dyecmd.cpp | 2 -- tools/dyecmd/src/imagewriter.cpp | 2 -- tools/dyecmd/src/imagewriter.h | 2 -- tools/tmxcopy/base64.cpp | 1 - tools/tmxcopy/base64.h | 1 - tools/tmxcopy/tostring.h | 2 -- tools/tmxcopy/xmlutils.cpp | 1 - tools/tmxcopy/xmlutils.h | 1 - 375 files changed, 735 deletions(-) (limited to 'src/gui/buy.h') diff --git a/src/animatedsprite.cpp b/src/animatedsprite.cpp index 13596a70..b2bb1f28 100644 --- a/src/animatedsprite.cpp +++ b/src/animatedsprite.cpp @@ -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$ */ #include "animatedsprite.h" diff --git a/src/animatedsprite.h b/src/animatedsprite.h index a1fbe7a0..405bf42e 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.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_ANIMATEDSPRITE_H diff --git a/src/animationparticle.cpp b/src/animationparticle.cpp index c79a5bc4..eb260157 100644 --- a/src/animationparticle.cpp +++ b/src/animationparticle.cpp @@ -17,7 +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 - * */ #include "animationparticle.h" diff --git a/src/animationparticle.h b/src/animationparticle.h index 054b1b73..eabc2742 100644 --- a/src/animationparticle.h +++ b/src/animationparticle.h @@ -17,7 +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 - * */ #ifndef _ANIMATION_PARTICLE diff --git a/src/being.cpp b/src/being.cpp index bac66d48..a267d033 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -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$ */ #include "being.h" diff --git a/src/being.h b/src/being.h index a0475910..bf11e3ed 100644 --- a/src/being.h +++ b/src/being.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_BEING_H diff --git a/src/beingmanager.cpp b/src/beingmanager.cpp index 40f438df..6d9267d2 100644 --- a/src/beingmanager.cpp +++ b/src/beingmanager.cpp @@ -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$ */ #include diff --git a/src/beingmanager.h b/src/beingmanager.h index f7a3b8f0..d3fb9888 100644 --- a/src/beingmanager.h +++ b/src/beingmanager.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_BEINGMANAGER_H diff --git a/src/channel.cpp b/src/channel.cpp index 969386f1..c62d6590 100644 --- a/src/channel.cpp +++ b/src/channel.cpp @@ -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$ */ diff --git a/src/channel.h b/src/channel.h index 3cb38a1c..01bd2728 100644 --- a/src/channel.h +++ b/src/channel.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$ */ #include diff --git a/src/channelmanager.cpp b/src/channelmanager.cpp index 3c66f4bb..a332edbb 100644 --- a/src/channelmanager.cpp +++ b/src/channelmanager.cpp @@ -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$ */ #include diff --git a/src/channelmanager.h b/src/channelmanager.h index 5e6b5ba1..c19c548a 100644 --- a/src/channelmanager.h +++ b/src/channelmanager.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_CHANNELMANAGER_H diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp index 5c7b5e52..4b1a0225 100644 --- a/src/commandhandler.cpp +++ b/src/commandhandler.cpp @@ -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$ */ diff --git a/src/commandhandler.h b/src/commandhandler.h index 10a4376f..eab0f077 100644 --- a/src/commandhandler.h +++ b/src/commandhandler.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_COMMANDHANDLER_H diff --git a/src/configlistener.h b/src/configlistener.h index 7ce5d949..b740720f 100644 --- a/src/configlistener.h +++ b/src/configlistener.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_CONFIGLISTENER_H diff --git a/src/configuration.cpp b/src/configuration.cpp index 864ad7c3..e801083f 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -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$ */ diff --git a/src/configuration.h b/src/configuration.h index 28246a02..a2d3b55d 100644 --- a/src/configuration.h +++ b/src/configuration.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_CONFIGURATION_H diff --git a/src/effectmanager.cpp b/src/effectmanager.cpp index 87d98834..52f1eb31 100644 --- a/src/effectmanager.cpp +++ b/src/effectmanager.cpp @@ -17,7 +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 - * */ #include "effectmanager.h" diff --git a/src/effectmanager.h b/src/effectmanager.h index b5451f27..1ae82caf 100644 --- a/src/effectmanager.h +++ b/src/effectmanager.h @@ -17,7 +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 - * */ #ifndef _EFFECT_MANAGER_H diff --git a/src/engine.cpp b/src/engine.cpp index e4b25c02..ba5ce5e3 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -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$ */ #include "engine.h" diff --git a/src/engine.h b/src/engine.h index 0e77bf3d..dbee1258 100644 --- a/src/engine.h +++ b/src/engine.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 _ENGINE_H diff --git a/src/equipment.cpp b/src/equipment.cpp index 265f230a..aa56b791 100644 --- a/src/equipment.cpp +++ b/src/equipment.cpp @@ -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$ */ #include diff --git a/src/equipment.h b/src/equipment.h index 7a0c8238..736074dd 100644 --- a/src/equipment.h +++ b/src/equipment.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_EQUIPMENT_H_ diff --git a/src/floor_item.cpp b/src/floor_item.cpp index 9727093f..7ad3c0c0 100644 --- a/src/floor_item.cpp +++ b/src/floor_item.cpp @@ -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$ */ #include "floor_item.h" diff --git a/src/floor_item.h b/src/floor_item.h index a87e3f79..b747310b 100644 --- a/src/floor_item.h +++ b/src/floor_item.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_FLOORITEM_H_ diff --git a/src/flooritemmanager.cpp b/src/flooritemmanager.cpp index c28755fb..68c84b5b 100644 --- a/src/flooritemmanager.cpp +++ b/src/flooritemmanager.cpp @@ -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$ */ #include "flooritemmanager.h" diff --git a/src/flooritemmanager.h b/src/flooritemmanager.h index c12883a4..3dbaf988 100644 --- a/src/flooritemmanager.h +++ b/src/flooritemmanager.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_FLOORITEMMANAGER_H diff --git a/src/game.cpp b/src/game.cpp index 421c8aac..df6d5578 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -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$ */ #include "game.h" diff --git a/src/game.h b/src/game.h index 56923bd0..4035584b 100644 --- a/src/game.h +++ b/src/game.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_GAME_ diff --git a/src/graphics.cpp b/src/graphics.cpp index 586f9f49..6920bcb0 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -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$ */ #include diff --git a/src/graphics.h b/src/graphics.h index 564826a2..efdd1ac1 100644 --- a/src/graphics.h +++ b/src/graphics.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 _GRAPHICS_H diff --git a/src/gui/box.cpp b/src/gui/box.cpp index 6af3ae3e..59d8c135 100644 --- a/src/gui/box.cpp +++ b/src/gui/box.cpp @@ -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$ */ #include "box.h" diff --git a/src/gui/box.h b/src/gui/box.h index ed1a7163..46654b48 100644 --- a/src/gui/box.h +++ b/src/gui/box.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$ */ diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index 53a2ac0f..b0b6f48e 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -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$ */ #include diff --git a/src/gui/browserbox.h b/src/gui/browserbox.h index 0a9032e4..465ff497 100644 --- a/src/gui/browserbox.h +++ b/src/gui/browserbox.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_BROWSERBOX_H__ diff --git a/src/gui/buddywindow.cpp b/src/gui/buddywindow.cpp index 0ed383ce..14a941a5 100644 --- a/src/gui/buddywindow.cpp +++ b/src/gui/buddywindow.cpp @@ -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$ */ #include "buddywindow.h" diff --git a/src/gui/buddywindow.h b/src/gui/buddywindow.h index a3ca4de2..6b07f470 100644 --- a/src/gui/buddywindow.h +++ b/src/gui/buddywindow.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_BUDDYWINDOW_H diff --git a/src/gui/button.cpp b/src/gui/button.cpp index c6bc4ccb..40ecd1b7 100644 --- a/src/gui/button.cpp +++ b/src/gui/button.cpp @@ -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$ */ #include diff --git a/src/gui/button.h b/src/gui/button.h index d12173b2..f451416c 100644 --- a/src/gui/button.h +++ b/src/gui/button.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_BUTTON_H diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 49d19675..a948b136 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -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$ */ #include "buy.h" diff --git a/src/gui/buy.h b/src/gui/buy.h index ec7419be..24f18742 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.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_BUY_H diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index ae5c7358..42380882 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -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$ */ #include "buysell.h" diff --git a/src/gui/buysell.h b/src/gui/buysell.h index 97caf34b..2391ed1c 100644 --- a/src/gui/buysell.h +++ b/src/gui/buysell.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_BUYSELL_H diff --git a/src/gui/changeemaildialog.cpp b/src/gui/changeemaildialog.cpp index 94253d31..c9bc2570 100644 --- a/src/gui/changeemaildialog.cpp +++ b/src/gui/changeemaildialog.cpp @@ -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$ */ #include "changeemaildialog.h" diff --git a/src/gui/changeemaildialog.h b/src/gui/changeemaildialog.h index 862c9d10..8ec3705d 100644 --- a/src/gui/changeemaildialog.h +++ b/src/gui/changeemaildialog.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_GUI_CHANGEEMAIL_H diff --git a/src/gui/changepassworddialog.cpp b/src/gui/changepassworddialog.cpp index e3bb0511..8d667790 100644 --- a/src/gui/changepassworddialog.cpp +++ b/src/gui/changepassworddialog.cpp @@ -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$ */ #include "changepassworddialog.h" diff --git a/src/gui/changepassworddialog.h b/src/gui/changepassworddialog.h index 450cce61..0cf744da 100644 --- a/src/gui/changepassworddialog.h +++ b/src/gui/changepassworddialog.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_CHANGEPASSWORDDIALOG_H diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index c011aa84..3adfbc08 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -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$ */ #include "char_select.h" diff --git a/src/gui/char_select.h b/src/gui/char_select.h index 0c1dbe45..ed03cedd 100644 --- a/src/gui/char_select.h +++ b/src/gui/char_select.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 _CHAR_SELECT_H diff --git a/src/gui/chargedialog.cpp b/src/gui/chargedialog.cpp index 862378ae..1c9edf45 100644 --- a/src/gui/chargedialog.cpp +++ b/src/gui/chargedialog.cpp @@ -17,7 +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 - * */ /* The window supported by this class shows player stats and keeps a charging diff --git a/src/gui/chargedialog.h b/src/gui/chargedialog.h index c09c692c..9517ef6a 100644 --- a/src/gui/chargedialog.h +++ b/src/gui/chargedialog.h @@ -17,7 +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 - * */ #ifndef _TMW_CHARGE_H diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 82e7d372..c94429c8 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -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$ */ #include diff --git a/src/gui/chat.h b/src/gui/chat.h index f7af6480..a41b11fb 100644 --- a/src/gui/chat.h +++ b/src/gui/chat.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_CHAT_H diff --git a/src/gui/chatinput.cpp b/src/gui/chatinput.cpp index fc5d6aab..afe7f037 100644 --- a/src/gui/chatinput.cpp +++ b/src/gui/chatinput.cpp @@ -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$ */ #include "chatinput.h" diff --git a/src/gui/chatinput.h b/src/gui/chatinput.h index da2342ae..e04dfa6e 100644 --- a/src/gui/chatinput.h +++ b/src/gui/chatinput.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_CHATINPUT_H diff --git a/src/gui/checkbox.cpp b/src/gui/checkbox.cpp index 5b300d33..20e24dee 100644 --- a/src/gui/checkbox.cpp +++ b/src/gui/checkbox.cpp @@ -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$ */ #include "checkbox.h" diff --git a/src/gui/checkbox.h b/src/gui/checkbox.h index 262e63ae..839ca97e 100644 --- a/src/gui/checkbox.h +++ b/src/gui/checkbox.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_CHECKBOX_H diff --git a/src/gui/confirm_dialog.cpp b/src/gui/confirm_dialog.cpp index 65ca27f7..5f2b9cb2 100644 --- a/src/gui/confirm_dialog.cpp +++ b/src/gui/confirm_dialog.cpp @@ -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$ */ #include "confirm_dialog.h" diff --git a/src/gui/confirm_dialog.h b/src/gui/confirm_dialog.h index 8728f83f..c9bfca02 100644 --- a/src/gui/confirm_dialog.h +++ b/src/gui/confirm_dialog.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_OPTION_DIALOG_H diff --git a/src/gui/connection.cpp b/src/gui/connection.cpp index a9fa2a56..f54c9dd5 100644 --- a/src/gui/connection.cpp +++ b/src/gui/connection.cpp @@ -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$ */ #include "connection.h" diff --git a/src/gui/connection.h b/src/gui/connection.h index 51ad5467..36ccd8a9 100644 --- a/src/gui/connection.h +++ b/src/gui/connection.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_CONNECTION_H diff --git a/src/gui/debugwindow.cpp b/src/gui/debugwindow.cpp index 3d0690b9..d92c3575 100644 --- a/src/gui/debugwindow.cpp +++ b/src/gui/debugwindow.cpp @@ -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$ */ #include "debugwindow.h" diff --git a/src/gui/debugwindow.h b/src/gui/debugwindow.h index 9b6f2017..ae1d8b14 100644 --- a/src/gui/debugwindow.h +++ b/src/gui/debugwindow.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_DEBUGWINDOW_H diff --git a/src/gui/equipmentwindow.cpp b/src/gui/equipmentwindow.cpp index 9a96b4d6..aee262d0 100644 --- a/src/gui/equipmentwindow.cpp +++ b/src/gui/equipmentwindow.cpp @@ -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$ */ #define BOX_WIDTH 36 diff --git a/src/gui/equipmentwindow.h b/src/gui/equipmentwindow.h index 696f4fc6..b6d2e2f4 100644 --- a/src/gui/equipmentwindow.h +++ b/src/gui/equipmentwindow.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_EQUIPMENT_H diff --git a/src/gui/focushandler.cpp b/src/gui/focushandler.cpp index ffdb7896..1bda568e 100644 --- a/src/gui/focushandler.cpp +++ b/src/gui/focushandler.cpp @@ -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$ */ #include "focushandler.h" diff --git a/src/gui/focushandler.h b/src/gui/focushandler.h index 252fdd9d..a5218485 100644 --- a/src/gui/focushandler.h +++ b/src/gui/focushandler.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_FOCUSHANDLER_H diff --git a/src/gui/gccontainer.cpp b/src/gui/gccontainer.cpp index 1edb4daf..ec3c8a5c 100644 --- a/src/gui/gccontainer.cpp +++ b/src/gui/gccontainer.cpp @@ -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$ */ #include "gccontainer.h" diff --git a/src/gui/gccontainer.h b/src/gui/gccontainer.h index 8b8a7ffe..cc7c9336 100644 --- a/src/gui/gccontainer.h +++ b/src/gui/gccontainer.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_GUI_GCCONTAINER_H diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index bc2f017b..6803be65 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -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$ */ #include "gui.h" diff --git a/src/gui/gui.h b/src/gui/gui.h index 84f52a31..a07d236f 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.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_GUI diff --git a/src/gui/guildlistbox.cpp b/src/gui/guildlistbox.cpp index 5fe62fe5..556df3fe 100644 --- a/src/gui/guildlistbox.cpp +++ b/src/gui/guildlistbox.cpp @@ -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 $ */ #include "guildlistbox.h" diff --git a/src/gui/guildlistbox.h b/src/gui/guildlistbox.h index b3892955..cc8e3ce7 100644 --- a/src/gui/guildlistbox.h +++ b/src/gui/guildlistbox.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_GUI_GUILDLISTBOX_H diff --git a/src/gui/guildwindow.cpp b/src/gui/guildwindow.cpp index 3319489c..ae9684df 100644 --- a/src/gui/guildwindow.cpp +++ b/src/gui/guildwindow.cpp @@ -17,7 +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 - * * $$ */ diff --git a/src/gui/guildwindow.h b/src/gui/guildwindow.h index e1bd99d7..4f6b9cbb 100644 --- a/src/gui/guildwindow.h +++ b/src/gui/guildwindow.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_GUI_GUILDWINDOW_H diff --git a/src/gui/hbox.cpp b/src/gui/hbox.cpp index 69564fbb..020e85c6 100644 --- a/src/gui/hbox.cpp +++ b/src/gui/hbox.cpp @@ -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$ */ #include "hbox.h" diff --git a/src/gui/hbox.h b/src/gui/hbox.h index 560b1a29..4b241383 100644 --- a/src/gui/hbox.h +++ b/src/gui/hbox.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 HBOX_H diff --git a/src/gui/help.cpp b/src/gui/help.cpp index 87de1e2f..ffe9c02d 100644 --- a/src/gui/help.cpp +++ b/src/gui/help.cpp @@ -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$ */ #include "help.h" diff --git a/src/gui/help.h b/src/gui/help.h index 3c3715a0..053df723 100644 --- a/src/gui/help.h +++ b/src/gui/help.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_HELP_H diff --git a/src/gui/icon.cpp b/src/gui/icon.cpp index 58b3ae8a..1e352292 100644 --- a/src/gui/icon.cpp +++ b/src/gui/icon.cpp @@ -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$ */ #include "icon.h" diff --git a/src/gui/icon.h b/src/gui/icon.h index f0d3a70a..9baf1a99 100644 --- a/src/gui/icon.h +++ b/src/gui/icon.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$ */ diff --git a/src/gui/inttextbox.cpp b/src/gui/inttextbox.cpp index 17e87afd..644601cf 100644 --- a/src/gui/inttextbox.cpp +++ b/src/gui/inttextbox.cpp @@ -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$ */ #include "inttextbox.h" diff --git a/src/gui/inttextbox.h b/src/gui/inttextbox.h index 219c6018..8dad0c39 100644 --- a/src/gui/inttextbox.h +++ b/src/gui/inttextbox.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 INTTEXTBOX_H diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 2127442a..82b36aef 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -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$ */ #include "inventorywindow.h" diff --git a/src/gui/inventorywindow.h b/src/gui/inventorywindow.h index f9ff8ea2..a7130b65 100644 --- a/src/gui/inventorywindow.h +++ b/src/gui/inventorywindow.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_INVENTORYWINDOW_H diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp index 6f1c8ae6..c6763014 100644 --- a/src/gui/item_amount.cpp +++ b/src/gui/item_amount.cpp @@ -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$ */ #include "item_amount.h" diff --git a/src/gui/item_amount.h b/src/gui/item_amount.h index 03303603..dd1026b7 100644 --- a/src/gui/item_amount.h +++ b/src/gui/item_amount.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_ITEM_AMOUNT_WINDOW_H diff --git a/src/gui/itemcontainer.cpp b/src/gui/itemcontainer.cpp index 4c528a16..5fb99ffc 100644 --- a/src/gui/itemcontainer.cpp +++ b/src/gui/itemcontainer.cpp @@ -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$ */ #include "itemcontainer.h" diff --git a/src/gui/itemcontainer.h b/src/gui/itemcontainer.h index 9ae5c9c2..8d93671c 100644 --- a/src/gui/itemcontainer.h +++ b/src/gui/itemcontainer.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_ITEMCONTAINER_H__ diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index cf719f9f..02d35570 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -18,8 +18,6 @@ * 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 - * - * $Id$ */ #include "itempopup.h" diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h index 499b2e0a..cb55296c 100644 --- a/src/gui/itempopup.h +++ b/src/gui/itempopup.h @@ -1,5 +1,4 @@ /* -* * The Legend of Mazzeroth * Copyright (C) 2008, The Legend of Mazzeroth Development Team * @@ -19,8 +18,6 @@ * 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 - * - * $Id$ */ #ifndef _LOM_ITEMPOPUP_H__ diff --git a/src/gui/itemshortcutcontainer.cpp b/src/gui/itemshortcutcontainer.cpp index 23b41650..76104e12 100644 --- a/src/gui/itemshortcutcontainer.cpp +++ b/src/gui/itemshortcutcontainer.cpp @@ -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$ */ #include "itemshortcutcontainer.h" diff --git a/src/gui/itemshortcutcontainer.h b/src/gui/itemshortcutcontainer.h index 58f0aea7..76ca870c 100644 --- a/src/gui/itemshortcutcontainer.h +++ b/src/gui/itemshortcutcontainer.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_ITEMSHORTCUTCONTAINER_H__ diff --git a/src/gui/itemshortcutwindow.cpp b/src/gui/itemshortcutwindow.cpp index fb75e20d..e4d352fe 100644 --- a/src/gui/itemshortcutwindow.cpp +++ b/src/gui/itemshortcutwindow.cpp @@ -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$ */ #include "itemshortcutwindow.h" diff --git a/src/gui/itemshortcutwindow.h b/src/gui/itemshortcutwindow.h index 9742abdc..017df5ec 100644 --- a/src/gui/itemshortcutwindow.h +++ b/src/gui/itemshortcutwindow.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_ITEMSHORTCUTWINDOW_H diff --git a/src/gui/linkhandler.h b/src/gui/linkhandler.h index 3a32f825..44f906db 100644 --- a/src/gui/linkhandler.h +++ b/src/gui/linkhandler.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_LINK_HANDLER_H_ diff --git a/src/gui/listbox.cpp b/src/gui/listbox.cpp index ac18c2cd..204d7961 100644 --- a/src/gui/listbox.cpp +++ b/src/gui/listbox.cpp @@ -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$ */ #include "listbox.h" diff --git a/src/gui/listbox.h b/src/gui/listbox.h index 03a8b541..d42c7d3e 100644 --- a/src/gui/listbox.h +++ b/src/gui/listbox.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_LISTBOX_H diff --git a/src/gui/login.cpp b/src/gui/login.cpp index 72d7ee51..24c55e37 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -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$ */ #include "login.h" diff --git a/src/gui/login.h b/src/gui/login.h index d8ae7eaf..1c23a0f5 100644 --- a/src/gui/login.h +++ b/src/gui/login.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_LOGIN_H diff --git a/src/gui/magic.cpp b/src/gui/magic.cpp index 28e7de92..a31b661a 100644 --- a/src/gui/magic.cpp +++ b/src/gui/magic.cpp @@ -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: skill.cpp 4569 2008-09-04 20:09:57Z b_lindeijer $ */ #include diff --git a/src/gui/magic.h b/src/gui/magic.h index a8082755..af46c823 100644 --- a/src/gui/magic.h +++ b/src/gui/magic.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: skill.h 4476 2008-08-18 01:23:58Z rhoderyc $ */ #ifndef _TMW_MAGIC_H @@ -32,7 +30,6 @@ #include "../guichanfwd.h" - /** * The skill dialog. * diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp index c3e572a7..dbbb08d2 100644 --- a/src/gui/menuwindow.cpp +++ b/src/gui/menuwindow.cpp @@ -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$ */ #include "menuwindow.h" diff --git a/src/gui/menuwindow.h b/src/gui/menuwindow.h index f43b9921..03ec3380 100644 --- a/src/gui/menuwindow.h +++ b/src/gui/menuwindow.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_MENU_H diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 5f768609..501530f1 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -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$ */ #include "minimap.h" diff --git a/src/gui/minimap.h b/src/gui/minimap.h index 5e9458bf..f91dc22d 100644 --- a/src/gui/minimap.h +++ b/src/gui/minimap.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_MINIMAP_H diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp index 3742be64..424c3558 100644 --- a/src/gui/ministatus.cpp +++ b/src/gui/ministatus.cpp @@ -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$ */ #include "ministatus.h" diff --git a/src/gui/ministatus.h b/src/gui/ministatus.h index 1192bc1e..f512ef25 100644 --- a/src/gui/ministatus.h +++ b/src/gui/ministatus.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_MINISTATUS_H diff --git a/src/gui/newskill.cpp b/src/gui/newskill.cpp index 6783a546..20fc01bd 100644 --- a/src/gui/newskill.cpp +++ b/src/gui/newskill.cpp @@ -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$ */ /* This file implements the new skill dialog for use under the latest diff --git a/src/gui/newskill.h b/src/gui/newskill.h index 6e12169f..49476e5e 100644 --- a/src/gui/newskill.h +++ b/src/gui/newskill.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_NSKILL_H diff --git a/src/gui/npc_text.cpp b/src/gui/npc_text.cpp index fd02a14a..c593feb1 100644 --- a/src/gui/npc_text.cpp +++ b/src/gui/npc_text.cpp @@ -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$ */ #include "npc_text.h" diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index 0ef1b938..2c9771d3 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.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_NPC_TEXT_H diff --git a/src/gui/npclistdialog.cpp b/src/gui/npclistdialog.cpp index ff017a0e..918031b4 100644 --- a/src/gui/npclistdialog.cpp +++ b/src/gui/npclistdialog.cpp @@ -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$ */ #include "npclistdialog.h" diff --git a/src/gui/npclistdialog.h b/src/gui/npclistdialog.h index 02b9cd49..e21f9e8c 100644 --- a/src/gui/npclistdialog.h +++ b/src/gui/npclistdialog.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_GUI_NPCLISTDIALOG_H diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index 2d3fce64..3a72b21b 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -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$ */ #include "npcpostdialog.h" diff --git a/src/gui/npcpostdialog.h b/src/gui/npcpostdialog.h index e142dac5..1956c877 100644 --- a/src/gui/npcpostdialog.h +++ b/src/gui/npcpostdialog.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_GUI_NPCPOSTDIALOG_H diff --git a/src/gui/ok_dialog.cpp b/src/gui/ok_dialog.cpp index 37d66353..b03c3964 100644 --- a/src/gui/ok_dialog.cpp +++ b/src/gui/ok_dialog.cpp @@ -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$ */ #include "ok_dialog.h" diff --git a/src/gui/ok_dialog.h b/src/gui/ok_dialog.h index a7b24a90..cba12d72 100644 --- a/src/gui/ok_dialog.h +++ b/src/gui/ok_dialog.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 _OK_DIALOG_H diff --git a/src/gui/partywindow.cpp b/src/gui/partywindow.cpp index 1b963dae..262e3b2e 100644 --- a/src/gui/partywindow.cpp +++ b/src/gui/partywindow.cpp @@ -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: box.cpp 1456 2005-07-15 23:17:00Z b_lindeijer $ */ #include "partywindow.h" diff --git a/src/gui/partywindow.h b/src/gui/partywindow.h index f09eeb6a..e79bf392 100644 --- a/src/gui/partywindow.h +++ b/src/gui/partywindow.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: box.cpp 1456 2005-07-15 23:17:00Z b_lindeijer $ */ #ifndef _TMW_PARTYWINDOW_H diff --git a/src/gui/passwordfield.cpp b/src/gui/passwordfield.cpp index 533f54fb..01c7e15d 100644 --- a/src/gui/passwordfield.cpp +++ b/src/gui/passwordfield.cpp @@ -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$ */ #include "passwordfield.h" diff --git a/src/gui/passwordfield.h b/src/gui/passwordfield.h index cae1f92e..8a14b72a 100644 --- a/src/gui/passwordfield.h +++ b/src/gui/passwordfield.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_PASSWORDFIELD_H_ diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index e9237110..0a0c8a17 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -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$ */ #include diff --git a/src/gui/playerbox.h b/src/gui/playerbox.h index c226e750..78eeee91 100644 --- a/src/gui/playerbox.h +++ b/src/gui/playerbox.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_PLAYERBOX_H__ diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 2888382b..59ca0867 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -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$ */ #include "popupmenu.h" diff --git a/src/gui/popupmenu.h b/src/gui/popupmenu.h index 9fe9f866..2d10e6eb 100644 --- a/src/gui/popupmenu.h +++ b/src/gui/popupmenu.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_POPUP_MENU_H diff --git a/src/gui/progressbar.cpp b/src/gui/progressbar.cpp index 90a85478..9a47eefc 100644 --- a/src/gui/progressbar.cpp +++ b/src/gui/progressbar.cpp @@ -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$ */ #include "progressbar.h" diff --git a/src/gui/progressbar.h b/src/gui/progressbar.h index ddabbb77..0b1616f5 100644 --- a/src/gui/progressbar.h +++ b/src/gui/progressbar.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_PROGRESSBAR_H diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index 7ed4f913..563ed34a 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -17,7 +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 - * */ #include "quitdialog.h" diff --git a/src/gui/quitdialog.h b/src/gui/quitdialog.h index 97a03f2e..018f1e52 100644 --- a/src/gui/quitdialog.h +++ b/src/gui/quitdialog.h @@ -17,7 +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 - * */ #ifndef _TMW_QUITDIALOG_H diff --git a/src/gui/radiobutton.cpp b/src/gui/radiobutton.cpp index 57d6772d..619ec84f 100644 --- a/src/gui/radiobutton.cpp +++ b/src/gui/radiobutton.cpp @@ -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$ */ #include "radiobutton.h" diff --git a/src/gui/radiobutton.h b/src/gui/radiobutton.h index 3b97ad86..09f703dc 100644 --- a/src/gui/radiobutton.h +++ b/src/gui/radiobutton.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_RADIOBUTTON_H diff --git a/src/gui/register.cpp b/src/gui/register.cpp index 7e236a7d..051c0fa4 100644 --- a/src/gui/register.cpp +++ b/src/gui/register.cpp @@ -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$ */ #include "register.h" diff --git a/src/gui/register.h b/src/gui/register.h index 088e8f9b..79578461 100644 --- a/src/gui/register.h +++ b/src/gui/register.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_REGISTER_H diff --git a/src/gui/scrollarea.cpp b/src/gui/scrollarea.cpp index 255aa2d8..032e3f78 100644 --- a/src/gui/scrollarea.cpp +++ b/src/gui/scrollarea.cpp @@ -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$ */ #include diff --git a/src/gui/scrollarea.h b/src/gui/scrollarea.h index be361f68..d21dae11 100644 --- a/src/gui/scrollarea.h +++ b/src/gui/scrollarea.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_SCROLLAREA_H__ diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index cef53697..ee94b2c6 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -53,8 +53,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id$ */ #include "sdlinput.h" diff --git a/src/gui/sdlinput.h b/src/gui/sdlinput.h index e23178fa..72d949e1 100644 --- a/src/gui/sdlinput.h +++ b/src/gui/sdlinput.h @@ -53,8 +53,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id$ */ #ifndef _TMW_SDLINPUT_ diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 37626155..30e78368 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -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$ */ #include "sell.h" diff --git a/src/gui/sell.h b/src/gui/sell.h index 63a16770..742c28fb 100644 --- a/src/gui/sell.h +++ b/src/gui/sell.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_SELL_H diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index a6d1d1f0..b11aea6c 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -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$ */ #include diff --git a/src/gui/serverdialog.h b/src/gui/serverdialog.h index 53474611..268b1baf 100644 --- a/src/gui/serverdialog.h +++ b/src/gui/serverdialog.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_SERVERDIALOG_H diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index b6b052bc..2a60308b 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -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$ */ #include diff --git a/src/gui/setup.h b/src/gui/setup.h index 77173367..2142a67d 100644 --- a/src/gui/setup.h +++ b/src/gui/setup.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_SETUP_H diff --git a/src/gui/setup_audio.cpp b/src/gui/setup_audio.cpp index 1ed4fc94..4f09cde0 100644 --- a/src/gui/setup_audio.cpp +++ b/src/gui/setup_audio.cpp @@ -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$ */ #include "setup_audio.h" diff --git a/src/gui/setup_audio.h b/src/gui/setup_audio.h index 6e722f74..eaa55de6 100644 --- a/src/gui/setup_audio.h +++ b/src/gui/setup_audio.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_GUI_SETUP_AUDIO_H diff --git a/src/gui/setup_joystick.cpp b/src/gui/setup_joystick.cpp index 57adef28..9de5be9f 100644 --- a/src/gui/setup_joystick.cpp +++ b/src/gui/setup_joystick.cpp @@ -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$ */ #include "setup_joystick.h" diff --git a/src/gui/setup_joystick.h b/src/gui/setup_joystick.h index 6d3ad129..0b7ebe98 100644 --- a/src/gui/setup_joystick.h +++ b/src/gui/setup_joystick.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_GUI_SETUP_JOYSTICK_H diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp index 2b785dd5..270f4a0e 100644 --- a/src/gui/setup_keyboard.cpp +++ b/src/gui/setup_keyboard.cpp @@ -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$ */ #include "setup_keyboard.h" diff --git a/src/gui/setup_keyboard.h b/src/gui/setup_keyboard.h index b72e8746..50fa76fb 100644 --- a/src/gui/setup_keyboard.h +++ b/src/gui/setup_keyboard.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_GUI_SETUP_KEYBOARD_H diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index 4d9b5d74..51cee8e3 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -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$ */ #include "setup_video.h" diff --git a/src/gui/setup_video.h b/src/gui/setup_video.h index e4e9fcf1..17ca1241 100644 --- a/src/gui/setup_video.h +++ b/src/gui/setup_video.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_GUI_SETUP_VIDEO_H diff --git a/src/gui/setuptab.h b/src/gui/setuptab.h index a7d45b9a..6c276c35 100644 --- a/src/gui/setuptab.h +++ b/src/gui/setuptab.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_GUI_SETUPTAB_H diff --git a/src/gui/shop.cpp b/src/gui/shop.cpp index 2a7ea0ce..a521c75b 100644 --- a/src/gui/shop.cpp +++ b/src/gui/shop.cpp @@ -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$ */ #include "shop.h" diff --git a/src/gui/shop.h b/src/gui/shop.h index f4329b4d..62b60cae 100644 --- a/src/gui/shop.h +++ b/src/gui/shop.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 _SHOP_H diff --git a/src/gui/shoplistbox.cpp b/src/gui/shoplistbox.cpp index ba77be47..bce6a48c 100644 --- a/src/gui/shoplistbox.cpp +++ b/src/gui/shoplistbox.cpp @@ -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$ */ #include "shoplistbox.h" diff --git a/src/gui/shoplistbox.h b/src/gui/shoplistbox.h index d5e2d836..75f514ab 100644 --- a/src/gui/shoplistbox.h +++ b/src/gui/shoplistbox.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_SHOPLISTBOX_H diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 49037cbd..49bacaf0 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -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$ */ #include diff --git a/src/gui/skill.h b/src/gui/skill.h index 12f619bd..3d010daa 100644 --- a/src/gui/skill.h +++ b/src/gui/skill.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_SKILL_H diff --git a/src/gui/slider.cpp b/src/gui/slider.cpp index c94c7bfb..afeecf17 100644 --- a/src/gui/slider.cpp +++ b/src/gui/slider.cpp @@ -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$ */ #include "slider.h" diff --git a/src/gui/slider.h b/src/gui/slider.h index dc38b738..3b796425 100644 --- a/src/gui/slider.h +++ b/src/gui/slider.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_SLIDER_H diff --git a/src/gui/speechbubble.cpp b/src/gui/speechbubble.cpp index 815238b9..d3ef7bbe 100644 --- a/src/gui/speechbubble.cpp +++ b/src/gui/speechbubble.cpp @@ -18,8 +18,6 @@ * 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 - * - * $Id$ */ #include "speechbubble.h" diff --git a/src/gui/speechbubble.h b/src/gui/speechbubble.h index c4ca9109..ed69a8d2 100644 --- a/src/gui/speechbubble.h +++ b/src/gui/speechbubble.h @@ -18,8 +18,6 @@ * 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 - * - * $Id$ */ #ifndef _LOM_SPEECHBUBBLE_H__ diff --git a/src/gui/status.cpp b/src/gui/status.cpp index b9ebfecf..43f81135 100644 --- a/src/gui/status.cpp +++ b/src/gui/status.cpp @@ -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$ */ #include "status.h" diff --git a/src/gui/status.h b/src/gui/status.h index 6e613495..262b89f6 100644 --- a/src/gui/status.h +++ b/src/gui/status.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_STATUS_H diff --git a/src/gui/textbox.cpp b/src/gui/textbox.cpp index 8d16dc46..619265ec 100644 --- a/src/gui/textbox.cpp +++ b/src/gui/textbox.cpp @@ -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$ */ #include "textbox.h" diff --git a/src/gui/textbox.h b/src/gui/textbox.h index f06f98ec..2060e377 100644 --- a/src/gui/textbox.h +++ b/src/gui/textbox.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_TEXTBOX_H__ diff --git a/src/gui/textdialog.cpp b/src/gui/textdialog.cpp index 3986ed4e..05e43906 100644 --- a/src/gui/textdialog.cpp +++ b/src/gui/textdialog.cpp @@ -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$ */ #include "textdialog.h" diff --git a/src/gui/textdialog.h b/src/gui/textdialog.h index c03ce7e6..8b4e2cc3 100644 --- a/src/gui/textdialog.h +++ b/src/gui/textdialog.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_GUI_GUILD_DIALOG_H diff --git a/src/gui/textfield.cpp b/src/gui/textfield.cpp index 4fd85d36..49c0c91d 100644 --- a/src/gui/textfield.cpp +++ b/src/gui/textfield.cpp @@ -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$ */ #include diff --git a/src/gui/textfield.h b/src/gui/textfield.h index 36f921ac..b808fad2 100644 --- a/src/gui/textfield.h +++ b/src/gui/textfield.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_TEXTFIELD_H__ diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index c098c04c..38064f48 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -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$ */ #include diff --git a/src/gui/trade.h b/src/gui/trade.h index c8ece8d9..c51e0fdd 100644 --- a/src/gui/trade.h +++ b/src/gui/trade.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_TRADE_H diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index 7f9abd3a..1132c3b5 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -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$ */ #include "truetypefont.h" diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h index 6dbc6634..3b39329e 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/unregisterdialog.cpp b/src/gui/unregisterdialog.cpp index 4b8755d5..1e09ca23 100644 --- a/src/gui/unregisterdialog.cpp +++ b/src/gui/unregisterdialog.cpp @@ -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$ */ #include "unregisterdialog.h" diff --git a/src/gui/unregisterdialog.h b/src/gui/unregisterdialog.h index 8c8eaf64..4056d251 100644 --- a/src/gui/unregisterdialog.h +++ b/src/gui/unregisterdialog.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_UNREGISTERDIALOG_H diff --git a/src/gui/updatewindow.cpp b/src/gui/updatewindow.cpp index 22bf8c13..ff1e600c 100644 --- a/src/gui/updatewindow.cpp +++ b/src/gui/updatewindow.cpp @@ -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$ */ #include "updatewindow.h" diff --git a/src/gui/updatewindow.h b/src/gui/updatewindow.h index 61ea4a27..d7e3c4c7 100644 --- a/src/gui/updatewindow.h +++ b/src/gui/updatewindow.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 _UPDATERWINDOW_H diff --git a/src/gui/vbox.cpp b/src/gui/vbox.cpp index b503508e..2ec1112d 100644 --- a/src/gui/vbox.cpp +++ b/src/gui/vbox.cpp @@ -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$ */ #include "vbox.h" diff --git a/src/gui/vbox.h b/src/gui/vbox.h index 06a270ef..2072ab24 100644 --- a/src/gui/vbox.h +++ b/src/gui/vbox.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 VBOX_H diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 14239094..1795836d 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -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$ */ #include "viewport.h" diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 5dedcea8..dd17fa24 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.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_VIEWPORT_H_ diff --git a/src/gui/widgets/avatar.cpp b/src/gui/widgets/avatar.cpp index 03fa1aeb..68ce5243 100644 --- a/src/gui/widgets/avatar.cpp +++ b/src/gui/widgets/avatar.cpp @@ -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$ */ #include "avatar.h" diff --git a/src/gui/widgets/avatar.h b/src/gui/widgets/avatar.h index 3707e8f8..0f657895 100644 --- a/src/gui/widgets/avatar.h +++ b/src/gui/widgets/avatar.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_AVATAR_H diff --git a/src/gui/widgets/dropdown.cpp b/src/gui/widgets/dropdown.cpp index b33a55cf..d4c2bc4b 100644 --- a/src/gui/widgets/dropdown.cpp +++ b/src/gui/widgets/dropdown.cpp @@ -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$ */ #include diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index d0dab7d2..58a18a15 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.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 DROPDOWN_H diff --git a/src/gui/widgets/layout.cpp b/src/gui/widgets/layout.cpp index 02ed42a1..bcc54cf7 100644 --- a/src/gui/widgets/layout.cpp +++ b/src/gui/widgets/layout.cpp @@ -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$ */ #include diff --git a/src/gui/widgets/layout.h b/src/gui/widgets/layout.h index 5914b5c1..d631c154 100644 --- a/src/gui/widgets/layout.h +++ b/src/gui/widgets/layout.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_WIDGET_LAYOUT_H__ diff --git a/src/gui/widgets/resizegrip.cpp b/src/gui/widgets/resizegrip.cpp index 6be50f2c..c3b537db 100644 --- a/src/gui/widgets/resizegrip.cpp +++ b/src/gui/widgets/resizegrip.cpp @@ -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$ */ #include "resizegrip.h" diff --git a/src/gui/widgets/resizegrip.h b/src/gui/widgets/resizegrip.h index 04be3db3..f57eda94 100644 --- a/src/gui/widgets/resizegrip.h +++ b/src/gui/widgets/resizegrip.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_RESIZEGRIP_H diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp index 990c6a95..c53ac85c 100644 --- a/src/gui/widgets/tab.cpp +++ b/src/gui/widgets/tab.cpp @@ -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$ */ #include diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h index b18c93e3..42964b0f 100644 --- a/src/gui/widgets/tab.h +++ b/src/gui/widgets/tab.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_TAB_H diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 7a4d153a..205fdc99 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -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$ */ #include "tabbedarea.h" diff --git a/src/gui/widgets/tabbedarea.h b/src/gui/widgets/tabbedarea.h index 554a68b6..2199264b 100644 --- a/src/gui/widgets/tabbedarea.h +++ b/src/gui/widgets/tabbedarea.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_TABBEDAREA_H diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 2bce49b2..e498236a 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -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$ */ #include diff --git a/src/gui/window.h b/src/gui/window.h index 44982500..22355572 100644 --- a/src/gui/window.h +++ b/src/gui/window.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_WINDOW_H__ diff --git a/src/gui/windowcontainer.cpp b/src/gui/windowcontainer.cpp index 006dbf44..d8535f73 100644 --- a/src/gui/windowcontainer.cpp +++ b/src/gui/windowcontainer.cpp @@ -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$ */ #include "windowcontainer.h" diff --git a/src/gui/windowcontainer.h b/src/gui/windowcontainer.h index df255f84..88a13d31 100644 --- a/src/gui/windowcontainer.h +++ b/src/gui/windowcontainer.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_WINDOWCONTAINER_H_ diff --git a/src/guichanfwd.h b/src/guichanfwd.h index 812f3f7a..4fb7ea3e 100644 --- a/src/guichanfwd.h +++ b/src/guichanfwd.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_GUICHANFWD_H diff --git a/src/guild.cpp b/src/guild.cpp index c02af865..68e65cb9 100644 --- a/src/guild.cpp +++ b/src/guild.cpp @@ -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$ */ #include "guild.h" diff --git a/src/guild.h b/src/guild.h index e262d3df..7c85fe31 100644 --- a/src/guild.h +++ b/src/guild.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_GUILD_H diff --git a/src/imageparticle.cpp b/src/imageparticle.cpp index 965434b0..65780345 100644 --- a/src/imageparticle.cpp +++ b/src/imageparticle.cpp @@ -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$ */ #include "imageparticle.h" diff --git a/src/imageparticle.h b/src/imageparticle.h index 0ad515cc..91c5426c 100644 --- a/src/imageparticle.h +++ b/src/imageparticle.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 _IMAGEPARTICLE_H diff --git a/src/inventory.cpp b/src/inventory.cpp index 807e1223..85461f90 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -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$ */ #include "inventory.h" diff --git a/src/inventory.h b/src/inventory.h index 48ace29c..90d9c7a2 100644 --- a/src/inventory.h +++ b/src/inventory.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 _INVENTORY_H diff --git a/src/item.cpp b/src/item.cpp index 210589e9..374d5051 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -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$ */ #include "item.h" diff --git a/src/item.h b/src/item.h index fc71e53d..37db52a4 100644 --- a/src/item.h +++ b/src/item.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 _ITEM_H_ diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp index 59c1ee3b..a89da974 100644 --- a/src/itemshortcut.cpp +++ b/src/itemshortcut.cpp @@ -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$ */ #include "itemshortcut.h" diff --git a/src/itemshortcut.h b/src/itemshortcut.h index d75db2e8..a0c52468 100644 --- a/src/itemshortcut.h +++ b/src/itemshortcut.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_ITEMSHORTCUT_H__ diff --git a/src/joystick.cpp b/src/joystick.cpp index a5dab4f4..b69537cf 100644 --- a/src/joystick.cpp +++ b/src/joystick.cpp @@ -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$ */ #include "joystick.h" diff --git a/src/joystick.h b/src/joystick.h index 321e3e7d..4cc1babd 100644 --- a/src/joystick.h +++ b/src/joystick.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_JOYSTICK_H diff --git a/src/keyboardconfig.cpp b/src/keyboardconfig.cpp index a959e244..37d5f276 100644 --- a/src/keyboardconfig.cpp +++ b/src/keyboardconfig.cpp @@ -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$ */ #include "keyboardconfig.h" diff --git a/src/keyboardconfig.h b/src/keyboardconfig.h index 53a5c96d..d9886150 100644 --- a/src/keyboardconfig.h +++ b/src/keyboardconfig.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_KEYBOARDCONFIG_H diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 30ad7b2e..14d253c0 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -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$ */ #include "localplayer.h" diff --git a/src/localplayer.h b/src/localplayer.h index 16b9715a..5dce5ebe 100644 --- a/src/localplayer.h +++ b/src/localplayer.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_LOCALPLAYER_H diff --git a/src/lockedarray.h b/src/lockedarray.h index f31292d7..8e525191 100644 --- a/src/lockedarray.h +++ b/src/lockedarray.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_LOCKEDARRAY_H diff --git a/src/logindata.h b/src/logindata.h index 689a5aaa..3d959ad4 100644 --- a/src/logindata.h +++ b/src/logindata.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_LOGINDATA_H diff --git a/src/main.cpp b/src/main.cpp index ede00d57..33900d5d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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$ */ #include "main.h" diff --git a/src/main.h b/src/main.h index d123834b..49173266 100644 --- a/src/main.h +++ b/src/main.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_MAIN_H diff --git a/src/map.cpp b/src/map.cpp index e10e4fad..5c2290d6 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -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$ */ #include "map.h" diff --git a/src/map.h b/src/map.h index c4a4fc0b..07bf2866 100644 --- a/src/map.h +++ b/src/map.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_MAP_H_ diff --git a/src/monster.cpp b/src/monster.cpp index 396d0c06..a62c1f4c 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -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$ */ #include "monster.h" diff --git a/src/monster.h b/src/monster.h index bde99ed6..5b6fcf61 100644 --- a/src/monster.h +++ b/src/monster.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_MONSTER_H diff --git a/src/net/accountserver/account.cpp b/src/net/accountserver/account.cpp index d1fe6863..f734c4eb 100644 --- a/src/net/accountserver/account.cpp +++ b/src/net/accountserver/account.cpp @@ -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$ */ #include "account.h" diff --git a/src/net/accountserver/account.h b/src/net/accountserver/account.h index 0cf0758e..581bcb42 100644 --- a/src/net/accountserver/account.h +++ b/src/net/accountserver/account.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_NET_ACCOUNTSERVER_CHARACTER_H diff --git a/src/net/accountserver/accountserver.cpp b/src/net/accountserver/accountserver.cpp index db94563b..b1ce590c 100644 --- a/src/net/accountserver/accountserver.cpp +++ b/src/net/accountserver/accountserver.cpp @@ -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$ */ #include "accountserver.h" diff --git a/src/net/accountserver/accountserver.h b/src/net/accountserver/accountserver.h index 8bfe991c..8e0573fc 100644 --- a/src/net/accountserver/accountserver.h +++ b/src/net/accountserver/accountserver.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_NET_ACCOUNTSERVER_ACCOUNTSERVER_H diff --git a/src/net/accountserver/internal.cpp b/src/net/accountserver/internal.cpp index 28a9695e..a3be76a1 100644 --- a/src/net/accountserver/internal.cpp +++ b/src/net/accountserver/internal.cpp @@ -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$ */ #include "internal.h" diff --git a/src/net/accountserver/internal.h b/src/net/accountserver/internal.h index 8af5ec04..35f986cd 100644 --- a/src/net/accountserver/internal.h +++ b/src/net/accountserver/internal.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_NET_ACCOUNTSERVER_INTERNAL_H diff --git a/src/net/beinghandler.cpp b/src/net/beinghandler.cpp index dd7d467b..72371da5 100644 --- a/src/net/beinghandler.cpp +++ b/src/net/beinghandler.cpp @@ -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$ */ #include "beinghandler.h" diff --git a/src/net/beinghandler.h b/src/net/beinghandler.h index 8ac07017..b02728b4 100644 --- a/src/net/beinghandler.h +++ b/src/net/beinghandler.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_NET_BEINGHANDLER_H diff --git a/src/net/buysellhandler.cpp b/src/net/buysellhandler.cpp index 57806edc..596ac434 100644 --- a/src/net/buysellhandler.cpp +++ b/src/net/buysellhandler.cpp @@ -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$ */ #include "buysellhandler.h" diff --git a/src/net/buysellhandler.h b/src/net/buysellhandler.h index e242d373..52e9b2f7 100644 --- a/src/net/buysellhandler.h +++ b/src/net/buysellhandler.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_NET_BUYSELLHANDLER_H diff --git a/src/net/charserverhandler.cpp b/src/net/charserverhandler.cpp index 6cc9e384..bde856a5 100644 --- a/src/net/charserverhandler.cpp +++ b/src/net/charserverhandler.cpp @@ -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$ */ #include "charserverhandler.h" diff --git a/src/net/charserverhandler.h b/src/net/charserverhandler.h index 4a4fe0c3..08ba5102 100644 --- a/src/net/charserverhandler.h +++ b/src/net/charserverhandler.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_NET_CHARSERVERHANDLER_H diff --git a/src/net/chathandler.cpp b/src/net/chathandler.cpp index 0cb59403..d81a8b7d 100644 --- a/src/net/chathandler.cpp +++ b/src/net/chathandler.cpp @@ -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$ */ #include "chathandler.h" diff --git a/src/net/chathandler.h b/src/net/chathandler.h index 7ca4d50d..aeaf5368 100644 --- a/src/net/chathandler.h +++ b/src/net/chathandler.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_NET_CHATHANDLER_H diff --git a/src/net/chatserver/chatserver.cpp b/src/net/chatserver/chatserver.cpp index f302a0ef..94e36b94 100644 --- a/src/net/chatserver/chatserver.cpp +++ b/src/net/chatserver/chatserver.cpp @@ -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$ */ #include "chatserver.h" diff --git a/src/net/chatserver/chatserver.h b/src/net/chatserver/chatserver.h index 10de1213..1129239a 100644 --- a/src/net/chatserver/chatserver.h +++ b/src/net/chatserver/chatserver.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_NET_CHATSERVER_CHATSERVER_H diff --git a/src/net/chatserver/guild.cpp b/src/net/chatserver/guild.cpp index fb400d5d..042ff013 100644 --- a/src/net/chatserver/guild.cpp +++ b/src/net/chatserver/guild.cpp @@ -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$ */ diff --git a/src/net/chatserver/guild.h b/src/net/chatserver/guild.h index 354ecd82..6c35be9f 100644 --- a/src/net/chatserver/guild.h +++ b/src/net/chatserver/guild.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$ */ diff --git a/src/net/chatserver/internal.cpp b/src/net/chatserver/internal.cpp index c1f7a3f7..0822d93d 100644 --- a/src/net/chatserver/internal.cpp +++ b/src/net/chatserver/internal.cpp @@ -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$ */ #include "internal.h" diff --git a/src/net/chatserver/internal.h b/src/net/chatserver/internal.h index 7579972b..b0f137c5 100644 --- a/src/net/chatserver/internal.h +++ b/src/net/chatserver/internal.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_NET_CHATSERVER_INTERNAL_H diff --git a/src/net/chatserver/party.cpp b/src/net/chatserver/party.cpp index ff465924..56eb57d2 100644 --- a/src/net/chatserver/party.cpp +++ b/src/net/chatserver/party.cpp @@ -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$ */ diff --git a/src/net/chatserver/party.h b/src/net/chatserver/party.h index 1d47c2c5..c1febd66 100644 --- a/src/net/chatserver/party.h +++ b/src/net/chatserver/party.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$ */ diff --git a/src/net/connection.cpp b/src/net/connection.cpp index caaa0ce1..7d3c2328 100644 --- a/src/net/connection.cpp +++ b/src/net/connection.cpp @@ -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$ */ #include "connection.h" diff --git a/src/net/connection.h b/src/net/connection.h index 734c8d65..4ab3d24d 100644 --- a/src/net/connection.h +++ b/src/net/connection.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_NET_CONNECTION_H diff --git a/src/net/effecthandler.cpp b/src/net/effecthandler.cpp index 04951d46..f7ff2bf2 100644 --- a/src/net/effecthandler.cpp +++ b/src/net/effecthandler.cpp @@ -17,7 +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 - * */ #include "effecthandler.h" diff --git a/src/net/effecthandler.h b/src/net/effecthandler.h index d836b341..283c7c10 100644 --- a/src/net/effecthandler.h +++ b/src/net/effecthandler.h @@ -17,7 +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 - * */ #ifndef _TMW_NET_EFFECTSHANDLER_H diff --git a/src/net/gameserver/gameserver.cpp b/src/net/gameserver/gameserver.cpp index e451d473..1bdaef26 100644 --- a/src/net/gameserver/gameserver.cpp +++ b/src/net/gameserver/gameserver.cpp @@ -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$ */ #include "gameserver.h" diff --git a/src/net/gameserver/gameserver.h b/src/net/gameserver/gameserver.h index 5bf196b6..5ea2c718 100644 --- a/src/net/gameserver/gameserver.h +++ b/src/net/gameserver/gameserver.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_NET_GAMESERVER_GAMESERVER_H diff --git a/src/net/gameserver/internal.cpp b/src/net/gameserver/internal.cpp index 328b4863..6b6ba081 100644 --- a/src/net/gameserver/internal.cpp +++ b/src/net/gameserver/internal.cpp @@ -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$ */ #include "internal.h" diff --git a/src/net/gameserver/internal.h b/src/net/gameserver/internal.h index 567e15d2..df9787fe 100644 --- a/src/net/gameserver/internal.h +++ b/src/net/gameserver/internal.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_NET_GAMESERVER_INTERNAL_H diff --git a/src/net/gameserver/player.cpp b/src/net/gameserver/player.cpp index cd85447c..95c13ec2 100644 --- a/src/net/gameserver/player.cpp +++ b/src/net/gameserver/player.cpp @@ -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$ */ #include "player.h" diff --git a/src/net/gameserver/player.h b/src/net/gameserver/player.h index 75e28270..9e68ced9 100644 --- a/src/net/gameserver/player.h +++ b/src/net/gameserver/player.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_NET_GAMESERVER_PLAYER_H diff --git a/src/net/guildhandler.cpp b/src/net/guildhandler.cpp index f6677cd8..cf886ab3 100644 --- a/src/net/guildhandler.cpp +++ b/src/net/guildhandler.cpp @@ -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$ */ #include diff --git a/src/net/guildhandler.h b/src/net/guildhandler.h index 01ad428b..4eb2da0b 100644 --- a/src/net/guildhandler.h +++ b/src/net/guildhandler.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_NET_GUILDHANDLER_H diff --git a/src/net/internal.cpp b/src/net/internal.cpp index 358aa143..4cb88a4e 100644 --- a/src/net/internal.cpp +++ b/src/net/internal.cpp @@ -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$ */ #include "internal.h" diff --git a/src/net/internal.h b/src/net/internal.h index e1ef648a..1e411605 100644 --- a/src/net/internal.h +++ b/src/net/internal.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_NET_INTERNAL_H diff --git a/src/net/inventoryhandler.cpp b/src/net/inventoryhandler.cpp index dde6a954..41032f13 100644 --- a/src/net/inventoryhandler.cpp +++ b/src/net/inventoryhandler.cpp @@ -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$ */ #include "inventoryhandler.h" diff --git a/src/net/inventoryhandler.h b/src/net/inventoryhandler.h index 4190bf83..1326ea71 100644 --- a/src/net/inventoryhandler.h +++ b/src/net/inventoryhandler.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_NET_INVENTORYHANDLER_H diff --git a/src/net/itemhandler.cpp b/src/net/itemhandler.cpp index ea65bc3b..af06084f 100644 --- a/src/net/itemhandler.cpp +++ b/src/net/itemhandler.cpp @@ -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$ */ #include "itemhandler.h" diff --git a/src/net/itemhandler.h b/src/net/itemhandler.h index 5ffcb134..e3005a6f 100644 --- a/src/net/itemhandler.h +++ b/src/net/itemhandler.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_NET_ITEMHANDLER_H diff --git a/src/net/loginhandler.cpp b/src/net/loginhandler.cpp index 6840d90c..f1898fb5 100644 --- a/src/net/loginhandler.cpp +++ b/src/net/loginhandler.cpp @@ -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$ */ #include "loginhandler.h" diff --git a/src/net/loginhandler.h b/src/net/loginhandler.h index 5bac079c..f557c97b 100644 --- a/src/net/loginhandler.h +++ b/src/net/loginhandler.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_NET_LOGINHANDLER_H diff --git a/src/net/logouthandler.cpp b/src/net/logouthandler.cpp index fb27540f..6dea4c83 100644 --- a/src/net/logouthandler.cpp +++ b/src/net/logouthandler.cpp @@ -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$ */ #include "logouthandler.h" diff --git a/src/net/logouthandler.h b/src/net/logouthandler.h index fa906234..369eaa80 100644 --- a/src/net/logouthandler.h +++ b/src/net/logouthandler.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_NET_LOGOUTHANDLER_H diff --git a/src/net/messagehandler.cpp b/src/net/messagehandler.cpp index b6074690..973c5555 100644 --- a/src/net/messagehandler.cpp +++ b/src/net/messagehandler.cpp @@ -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$ */ #include "messagehandler.h" diff --git a/src/net/messagehandler.h b/src/net/messagehandler.h index a5fc81b3..74226aa5 100644 --- a/src/net/messagehandler.h +++ b/src/net/messagehandler.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_NET_MESSAGEHANDLER_H diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index b5d5b97a..57c268e7 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -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$ */ #include "messagein.h" diff --git a/src/net/messagein.h b/src/net/messagein.h index 3cc45a23..444699c8 100644 --- a/src/net/messagein.h +++ b/src/net/messagein.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 _TMWSERV_MESSAGEIN_H_ diff --git a/src/net/messageout.cpp b/src/net/messageout.cpp index 10f1b1d4..b08332b6 100644 --- a/src/net/messageout.cpp +++ b/src/net/messageout.cpp @@ -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$ */ #include diff --git a/src/net/messageout.h b/src/net/messageout.h index 032db190..4eadda5f 100644 --- a/src/net/messageout.h +++ b/src/net/messageout.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 _TMWSERV_MESSAGEOUT_H_ diff --git a/src/net/network.cpp b/src/net/network.cpp index 7cf4bf49..a4ea3def 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -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$ */ #include "network.h" diff --git a/src/net/network.h b/src/net/network.h index 42590adf..13576e79 100644 --- a/src/net/network.h +++ b/src/net/network.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_NET_NETWORK_H diff --git a/src/net/npchandler.cpp b/src/net/npchandler.cpp index 4b08ed8d..30507537 100644 --- a/src/net/npchandler.cpp +++ b/src/net/npchandler.cpp @@ -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$ */ #include "npchandler.h" diff --git a/src/net/npchandler.h b/src/net/npchandler.h index 0cb40f64..5560787e 100644 --- a/src/net/npchandler.h +++ b/src/net/npchandler.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_NET_NPCHANDLER_H diff --git a/src/net/partyhandler.cpp b/src/net/partyhandler.cpp index 7a9768fa..60c51821 100644 --- a/src/net/partyhandler.cpp +++ b/src/net/partyhandler.cpp @@ -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$ */ #include diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h index dda78d94..b4257c34 100644 --- a/src/net/partyhandler.h +++ b/src/net/partyhandler.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_NET_PARTYHANDLER_H diff --git a/src/net/playerhandler.cpp b/src/net/playerhandler.cpp index 3c0a1835..ad271f15 100644 --- a/src/net/playerhandler.cpp +++ b/src/net/playerhandler.cpp @@ -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$ */ #include "playerhandler.h" diff --git a/src/net/playerhandler.h b/src/net/playerhandler.h index 9b6c9e01..9c5f87cc 100644 --- a/src/net/playerhandler.h +++ b/src/net/playerhandler.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_NET_PLAYERHANDLER_H diff --git a/src/net/protocol.h b/src/net/protocol.h index 2ed414a8..5dfa78da 100644 --- a/src/net/protocol.h +++ b/src/net/protocol.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_PROTOCOL_ diff --git a/src/net/tradehandler.cpp b/src/net/tradehandler.cpp index d75350bc..5d93016f 100644 --- a/src/net/tradehandler.cpp +++ b/src/net/tradehandler.cpp @@ -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$ */ #include "tradehandler.h" diff --git a/src/net/tradehandler.h b/src/net/tradehandler.h index 33dddf05..1a0fa695 100644 --- a/src/net/tradehandler.h +++ b/src/net/tradehandler.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_NET_TRADEHANDLER_H diff --git a/src/npc.cpp b/src/npc.cpp index a7302e0d..5665ad95 100644 --- a/src/npc.cpp +++ b/src/npc.cpp @@ -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$ */ #include "npc.h" diff --git a/src/npc.h b/src/npc.h index 561ad9f0..60f9e6d8 100644 --- a/src/npc.h +++ b/src/npc.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_NPC_H diff --git a/src/openglgraphics.cpp b/src/openglgraphics.cpp index 67248100..48b10a1f 100644 --- a/src/openglgraphics.cpp +++ b/src/openglgraphics.cpp @@ -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$ */ #include "main.h" diff --git a/src/openglgraphics.h b/src/openglgraphics.h index e6d4850b..ea30e019 100644 --- a/src/openglgraphics.h +++ b/src/openglgraphics.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_OPENGLGRAPHICS_H diff --git a/src/particle.cpp b/src/particle.cpp index c59d2c03..8a15a132 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -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$ */ #include diff --git a/src/particle.h b/src/particle.h index 7b46a641..4a11c4cb 100644 --- a/src/particle.h +++ b/src/particle.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 _PARTICLE_H diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index cd80fb58..d368237c 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -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$ */ #include "particleemitter.h" diff --git a/src/particleemitter.h b/src/particleemitter.h index c237c1ba..4dc2f6fb 100644 --- a/src/particleemitter.h +++ b/src/particleemitter.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 _PARTICLEEMITTER_H diff --git a/src/player.cpp b/src/player.cpp index 97c60789..648b330a 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -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$ */ #include "player.h" diff --git a/src/player.h b/src/player.h index 7e86b1e1..068e3cf5 100644 --- a/src/player.h +++ b/src/player.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_PLAYER_H diff --git a/src/position.cpp b/src/position.cpp index 334079bb..cc39a1af 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -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$ */ #include "position.h" diff --git a/src/position.h b/src/position.h index d1aa2ee6..7beb3ef7 100644 --- a/src/position.h +++ b/src/position.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: being.h 4570 2008-09-04 20:59:34Z b_lindeijer $ */ #ifndef TMW_POSITION_H diff --git a/src/properties.h b/src/properties.h index 93148bdf..2eafeeca 100644 --- a/src/properties.h +++ b/src/properties.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_PROPERTIES_H_ diff --git a/src/resources/action.cpp b/src/resources/action.cpp index 6b3c2f52..ffbbffb2 100644 --- a/src/resources/action.cpp +++ b/src/resources/action.cpp @@ -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$ */ #include "action.h" diff --git a/src/resources/action.h b/src/resources/action.h index 8d5e8d11..09eb066e 100644 --- a/src/resources/action.h +++ b/src/resources/action.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_ACTION_H diff --git a/src/resources/ambientoverlay.cpp b/src/resources/ambientoverlay.cpp index 058b6083..9eee57f0 100644 --- a/src/resources/ambientoverlay.cpp +++ b/src/resources/ambientoverlay.cpp @@ -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$ */ #include "ambientoverlay.h" diff --git a/src/resources/ambientoverlay.h b/src/resources/ambientoverlay.h index a939cbb4..56c70066 100644 --- a/src/resources/ambientoverlay.h +++ b/src/resources/ambientoverlay.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_RESOURCES_AMBIENTOVERLAY_H_ diff --git a/src/resources/animation.cpp b/src/resources/animation.cpp index de96525c..d2794e61 100644 --- a/src/resources/animation.cpp +++ b/src/resources/animation.cpp @@ -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$ */ #include "animation.h" diff --git a/src/resources/animation.h b/src/resources/animation.h index aad93cda..8dfe8614 100644 --- a/src/resources/animation.h +++ b/src/resources/animation.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_ANIMATION_H diff --git a/src/resources/buddylist.cpp b/src/resources/buddylist.cpp index 32d8d9f4..c85105c5 100644 --- a/src/resources/buddylist.cpp +++ b/src/resources/buddylist.cpp @@ -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$ */ #include diff --git a/src/resources/buddylist.h b/src/resources/buddylist.h index 3791a03a..6a3de8c4 100644 --- a/src/resources/buddylist.h +++ b/src/resources/buddylist.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_BUDDYLIST_H diff --git a/src/resources/dye.cpp b/src/resources/dye.cpp index a43b1204..3be105d8 100644 --- a/src/resources/dye.cpp +++ b/src/resources/dye.cpp @@ -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$ */ #include diff --git a/src/resources/dye.h b/src/resources/dye.h index a11e3365..528a1d91 100644 --- a/src/resources/dye.h +++ b/src/resources/dye.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_DYE_H diff --git a/src/resources/image.cpp b/src/resources/image.cpp index d0dae462..77d77f96 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -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$ */ #include diff --git a/src/resources/image.h b/src/resources/image.h index 52f286f8..3677696f 100644 --- a/src/resources/image.h +++ b/src/resources/image.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_IMAGE_H diff --git a/src/resources/imageloader.cpp b/src/resources/imageloader.cpp index 6ec5fe8f..29458ba3 100644 --- a/src/resources/imageloader.cpp +++ b/src/resources/imageloader.cpp @@ -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$ */ #include diff --git a/src/resources/imageloader.h b/src/resources/imageloader.h index f41f6472..7979fd2f 100644 --- a/src/resources/imageloader.h +++ b/src/resources/imageloader.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_IMAGELOADER_H diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp index ba612103..1c0f9373 100644 --- a/src/resources/imageset.cpp +++ b/src/resources/imageset.cpp @@ -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$ */ #include "imageset.h" diff --git a/src/resources/imageset.h b/src/resources/imageset.h index fa1840ec..58b7a8ea 100644 --- a/src/resources/imageset.h +++ b/src/resources/imageset.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_IMAGESET_H diff --git a/src/resources/imagewriter.cpp b/src/resources/imagewriter.cpp index 7cfa16b4..d6d8a6c2 100644 --- a/src/resources/imagewriter.cpp +++ b/src/resources/imagewriter.cpp @@ -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$ */ #include "imagewriter.h" diff --git a/src/resources/imagewriter.h b/src/resources/imagewriter.h index 205e4584..632e2ae4 100644 --- a/src/resources/imagewriter.h +++ b/src/resources/imagewriter.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$ */ #include diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 306c0e5a..01688619 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -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$ */ #include diff --git a/src/resources/itemdb.h b/src/resources/itemdb.h index df7e7be9..20756a52 100644 --- a/src/resources/itemdb.h +++ b/src/resources/itemdb.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_ITEM_MANAGER_H diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 4322db8d..cc7a6afc 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -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$ */ #include "iteminfo.h" diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 5b500dcf..7cc3ba15 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.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_ITEMINFO_H_ diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp index 33616c0a..cec74717 100644 --- a/src/resources/mapreader.cpp +++ b/src/resources/mapreader.cpp @@ -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$ */ #include "mapreader.h" diff --git a/src/resources/mapreader.h b/src/resources/mapreader.h index 60056358..0142eb45 100644 --- a/src/resources/mapreader.h +++ b/src/resources/mapreader.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_MAPREADER_H_ diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp index f531a41d..1d198a96 100644 --- a/src/resources/monsterdb.cpp +++ b/src/resources/monsterdb.cpp @@ -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$ */ #include diff --git a/src/resources/monsterdb.h b/src/resources/monsterdb.h index 46a33b06..f1d69e72 100644 --- a/src/resources/monsterdb.h +++ b/src/resources/monsterdb.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_MONSTER_DB_H diff --git a/src/resources/monsterinfo.cpp b/src/resources/monsterinfo.cpp index 263810de..bac9c35f 100644 --- a/src/resources/monsterinfo.cpp +++ b/src/resources/monsterinfo.cpp @@ -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$ */ #include "monsterinfo.h" diff --git a/src/resources/monsterinfo.h b/src/resources/monsterinfo.h index f34a3ea9..f13c2f7c 100644 --- a/src/resources/monsterinfo.h +++ b/src/resources/monsterinfo.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_MONSTERINFO_H_ diff --git a/src/resources/music.cpp b/src/resources/music.cpp index 161d8b01..2386aa43 100644 --- a/src/resources/music.cpp +++ b/src/resources/music.cpp @@ -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$ */ #include "music.h" diff --git a/src/resources/music.h b/src/resources/music.h index 72e76295..d50150b8 100644 --- a/src/resources/music.h +++ b/src/resources/music.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_MUSIC_H diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index bc1c920e..5cd6d20d 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -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$ */ #include "npcdb.h" diff --git a/src/resources/npcdb.h b/src/resources/npcdb.h index 2abf959b..00b4f99b 100644 --- a/src/resources/npcdb.h +++ b/src/resources/npcdb.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_NPC_DB_H diff --git a/src/resources/resource.cpp b/src/resources/resource.cpp index 8f21f5d2..449caf55 100644 --- a/src/resources/resource.cpp +++ b/src/resources/resource.cpp @@ -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$ */ #include diff --git a/src/resources/resource.h b/src/resources/resource.h index 5b9a5eb8..e85e3147 100644 --- a/src/resources/resource.h +++ b/src/resources/resource.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_RESOURCE_H diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index 9c109257..8ee64452 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -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$ */ #include diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index da85e2f9..66813a9c 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.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_RESOURCE_MANAGER_H diff --git a/src/resources/soundeffect.cpp b/src/resources/soundeffect.cpp index ec9bc65c..e21fd2b0 100644 --- a/src/resources/soundeffect.cpp +++ b/src/resources/soundeffect.cpp @@ -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$ */ #include "soundeffect.h" diff --git a/src/resources/soundeffect.h b/src/resources/soundeffect.h index 866c53ec..c3ff6668 100644 --- a/src/resources/soundeffect.h +++ b/src/resources/soundeffect.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_SOUND_EFFECT_H diff --git a/src/resources/spritedef.cpp b/src/resources/spritedef.cpp index dcfee165..5aea55fa 100644 --- a/src/resources/spritedef.cpp +++ b/src/resources/spritedef.cpp @@ -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$ */ #include diff --git a/src/resources/spritedef.h b/src/resources/spritedef.h index e9946a7a..56b9a713 100644 --- a/src/resources/spritedef.h +++ b/src/resources/spritedef.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_SPRITEDEF_H diff --git a/src/serverinfo.h b/src/serverinfo.h index b317b87b..6522da61 100644 --- a/src/serverinfo.h +++ b/src/serverinfo.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_SERVERINFO_ diff --git a/src/shopitem.cpp b/src/shopitem.cpp index ed5d30a9..9888f829 100644 --- a/src/shopitem.cpp +++ b/src/shopitem.cpp @@ -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$ */ #include "shopitem.h" diff --git a/src/shopitem.h b/src/shopitem.h index 6e7606ac..05a0a67d 100644 --- a/src/shopitem.h +++ b/src/shopitem.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 _SHOPITEM_H_ diff --git a/src/simpleanimation.cpp b/src/simpleanimation.cpp index f425d3c1..e8c26df1 100644 --- a/src/simpleanimation.cpp +++ b/src/simpleanimation.cpp @@ -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$ */ #include "simpleanimation.h" diff --git a/src/simpleanimation.h b/src/simpleanimation.h index 561c540d..577268a8 100644 --- a/src/simpleanimation.h +++ b/src/simpleanimation.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_SIMPLEANIMAION_H diff --git a/src/sound.cpp b/src/sound.cpp index 0a20d3f2..888dcc31 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -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$ */ #include "sound.h" diff --git a/src/sound.h b/src/sound.h index ebcd6442..0c2af74b 100644 --- a/src/sound.h +++ b/src/sound.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_SOUND_H diff --git a/src/sprite.h b/src/sprite.h index 89780519..0e0a95db 100644 --- a/src/sprite.h +++ b/src/sprite.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_SPRITE_H_ diff --git a/src/textparticle.cpp b/src/textparticle.cpp index 89466006..308c043d 100644 --- a/src/textparticle.cpp +++ b/src/textparticle.cpp @@ -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$ */ #include "textparticle.h" diff --git a/src/textparticle.h b/src/textparticle.h index 34badb57..3a0ba674 100644 --- a/src/textparticle.h +++ b/src/textparticle.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 _TEXTPARTICLE_H diff --git a/src/tileset.h b/src/tileset.h index 625fac1b..fb855831 100644 --- a/src/tileset.h +++ b/src/tileset.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_TILESET_H_ diff --git a/src/utils/base64.cpp b/src/utils/base64.cpp index 9a8f6356..8cea60f9 100644 --- a/src/utils/base64.cpp +++ b/src/utils/base64.cpp @@ -26,7 +26,6 @@ | Author: Jim Winstead (jimw@php.net) | +----------------------------------------------------------------------+ */ -/* $Id$ */ #include #include diff --git a/src/utils/base64.h b/src/utils/base64.h index ff20ac53..c802207b 100644 --- a/src/utils/base64.h +++ b/src/utils/base64.h @@ -26,7 +26,6 @@ | Author: Jim Winstead (jimw@php.net) | +----------------------------------------------------------------------+ */ -/* $Id$ */ #ifndef _TMW_BASE64_H #define _TMW_BASE64_H diff --git a/src/utils/dtor.h b/src/utils/dtor.h index 516fd916..9aa92c84 100644 --- a/src/utils/dtor.h +++ b/src/utils/dtor.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_UTILS_DTOR_H diff --git a/src/utils/fastsqrt.h b/src/utils/fastsqrt.h index b7b036e9..78768149 100644 --- a/src/utils/fastsqrt.h +++ b/src/utils/fastsqrt.h @@ -5,8 +5,6 @@ * http://www.math.purdue.edu/~clomont/Math/Papers/2003/InvSqrt.pdf * * Unfortunately the original creator of this function seems to be unknown. - * - * $Id$ */ float fastInvSqrt(float x) diff --git a/src/utils/gettext.h b/src/utils/gettext.h index 72533850..0cd9114b 100644 --- a/src/utils/gettext.h +++ b/src/utils/gettext.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_UTILS_GETTEXT_H diff --git a/src/utils/minmax.h b/src/utils/minmax.h index 353c60e7..7e3d84f2 100644 --- a/src/utils/minmax.h +++ b/src/utils/minmax.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$ */ #include diff --git a/src/utils/sha256.cpp b/src/utils/sha256.cpp index 209d4f96..82d1fc5c 100644 --- a/src/utils/sha256.cpp +++ b/src/utils/sha256.cpp @@ -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$ */ /* +------------------------------------+ diff --git a/src/utils/sha256.h b/src/utils/sha256.h index c03efc0c..66152caf 100644 --- a/src/utils/sha256.h +++ b/src/utils/sha256.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_UTILS_SHA256_H_ diff --git a/src/utils/strprintf.cpp b/src/utils/strprintf.cpp index 26313fe9..c8a8a247 100644 --- a/src/utils/strprintf.cpp +++ b/src/utils/strprintf.cpp @@ -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_UTILS_TOSTRING_H diff --git a/src/utils/strprintf.h b/src/utils/strprintf.h index a1fb0f13..382ab6e0 100644 --- a/src/utils/strprintf.h +++ b/src/utils/strprintf.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_UTILS_STRPRINTF_H diff --git a/src/utils/tostring.h b/src/utils/tostring.h index 95b8985f..d2dd941a 100644 --- a/src/utils/tostring.h +++ b/src/utils/tostring.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_UTILS_TOSTRING_H diff --git a/src/utils/trim.h b/src/utils/trim.h index fec99100..a7c40ca2 100644 --- a/src/utils/trim.h +++ b/src/utils/trim.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_UTILS_TRIM_H_ diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 98b474cb..47f1bd04 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -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$ */ #include "xml.h" diff --git a/src/utils/xml.h b/src/utils/xml.h index 5473b2ca..5a5c756b 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.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_XML_H diff --git a/src/vector.cpp b/src/vector.cpp index 88092c9b..7d5f055a 100644 --- a/src/vector.cpp +++ b/src/vector.cpp @@ -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: vector.h 4592 2008-09-07 20:38:52Z b_lindeijer $ */ #include "vector.h" diff --git a/src/vector.h b/src/vector.h index 7251eff0..f32b201a 100644 --- a/src/vector.h +++ b/src/vector.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_VECTOR_H_ diff --git a/tools/dyecmd/src/dye.cpp b/tools/dyecmd/src/dye.cpp index 73912a96..c93f46c8 100644 --- a/tools/dyecmd/src/dye.cpp +++ b/tools/dyecmd/src/dye.cpp @@ -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$ */ #include diff --git a/tools/dyecmd/src/dye.h b/tools/dyecmd/src/dye.h index a11e3365..528a1d91 100644 --- a/tools/dyecmd/src/dye.h +++ b/tools/dyecmd/src/dye.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_DYE_H diff --git a/tools/dyecmd/src/dyecmd.cpp b/tools/dyecmd/src/dyecmd.cpp index 7254e287..8938aea5 100644 --- a/tools/dyecmd/src/dyecmd.cpp +++ b/tools/dyecmd/src/dyecmd.cpp @@ -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$ */ #include diff --git a/tools/dyecmd/src/imagewriter.cpp b/tools/dyecmd/src/imagewriter.cpp index 36c139b9..9b4b10dc 100644 --- a/tools/dyecmd/src/imagewriter.cpp +++ b/tools/dyecmd/src/imagewriter.cpp @@ -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$ */ #include "imagewriter.h" diff --git a/tools/dyecmd/src/imagewriter.h b/tools/dyecmd/src/imagewriter.h index 205e4584..632e2ae4 100644 --- a/tools/dyecmd/src/imagewriter.h +++ b/tools/dyecmd/src/imagewriter.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$ */ #include diff --git a/tools/tmxcopy/base64.cpp b/tools/tmxcopy/base64.cpp index 9a8f6356..8cea60f9 100644 --- a/tools/tmxcopy/base64.cpp +++ b/tools/tmxcopy/base64.cpp @@ -26,7 +26,6 @@ | Author: Jim Winstead (jimw@php.net) | +----------------------------------------------------------------------+ */ -/* $Id$ */ #include #include diff --git a/tools/tmxcopy/base64.h b/tools/tmxcopy/base64.h index ff20ac53..c802207b 100644 --- a/tools/tmxcopy/base64.h +++ b/tools/tmxcopy/base64.h @@ -26,7 +26,6 @@ | Author: Jim Winstead (jimw@php.net) | +----------------------------------------------------------------------+ */ -/* $Id$ */ #ifndef _TMW_BASE64_H #define _TMW_BASE64_H diff --git a/tools/tmxcopy/tostring.h b/tools/tmxcopy/tostring.h index 95b8985f..d2dd941a 100644 --- a/tools/tmxcopy/tostring.h +++ b/tools/tmxcopy/tostring.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_UTILS_TOSTRING_H diff --git a/tools/tmxcopy/xmlutils.cpp b/tools/tmxcopy/xmlutils.cpp index 47bff51a..8b1b62cf 100644 --- a/tools/tmxcopy/xmlutils.cpp +++ b/tools/tmxcopy/xmlutils.cpp @@ -17,7 +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 - * */ #include "xmlutils.h" diff --git a/tools/tmxcopy/xmlutils.h b/tools/tmxcopy/xmlutils.h index 32d1a960..60e8f3cd 100644 --- a/tools/tmxcopy/xmlutils.h +++ b/tools/tmxcopy/xmlutils.h @@ -17,7 +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 - * */ #ifndef _XMLUTILS_H -- cgit v1.2.3-70-g09d2 From 0fd9aef8bf376d44132edded2cdcb41ba7ee5b2f Mon Sep 17 00:00:00 2001 From: Bjørn Lindeijer Date: Mon, 5 Jan 2009 21:16:23 +0100 Subject: Mostly whitespace and formatting changes (merged from eAthena client) --- INSTALL | 7 +++--- docs/FAQ.txt | 12 +++++----- docs/INSTALL/win32.txt | 6 ++--- po/POTFILES.in | 1 + src/Makefile.am | 10 ++++----- src/gui/browserbox.cpp | 2 +- src/gui/browserbox.h | 2 +- src/gui/buy.cpp | 13 +++++------ src/gui/buy.h | 3 +-- src/gui/char_select.cpp | 1 - src/gui/inventorywindow.cpp | 3 +-- src/gui/item_amount.cpp | 3 +-- src/gui/item_amount.h | 2 +- src/gui/login.cpp | 3 ++- src/gui/menuwindow.cpp | 2 +- src/gui/npc_text.h | 2 +- src/gui/playerbox.cpp | 6 ++--- src/gui/popupmenu.cpp | 1 - src/gui/sell.cpp | 4 +--- src/gui/setup.cpp | 2 +- src/gui/setup_keyboard.cpp | 12 +++++----- src/gui/trade.cpp | 2 -- src/gui/window.cpp | 14 +++++------- src/gui/window.h | 23 ++++++++++---------- src/main.cpp | 2 +- src/net/messagein.h | 4 ++-- src/net/network.cpp | 46 ++++++++++++++++++--------------------- src/resources/npcdb.cpp | 1 - src/resources/resourcemanager.cpp | 6 ++++- src/utils/xml.cpp | 15 ++++++------- src/utils/xml.h | 10 ++++----- 31 files changed, 103 insertions(+), 117 deletions(-) (limited to 'src/gui/buy.h') diff --git a/INSTALL b/INSTALL index 3b790ffd..fd921f59 100644 --- a/INSTALL +++ b/INSTALL @@ -12,9 +12,9 @@ IRC: irc.freenode.net / #themanaworld 1. Requirements =============== -You are expected to have either checked out TMW from Subversion or you have -downloaded a source release. To get The Mana World to compile, you need a -compiler (GCC) and some libraries. The required libraries are: +You are expected to have either checked out TMW from Git or you have downloaded +a source release. To get The Mana World to compile, you need a compiler (GCC) +and some libraries. The required libraries are: * SDL http://www.libsdl.org/ * SDL_mixer http://www.libsdl.org/projects/SDL_mixer/ @@ -52,6 +52,7 @@ It should have installed The Mana World on your system now, and you can run it with "tmw". By default all files are installed to /usr/local, you can pass a different prefix to configure as usual. + NOTE: It is possible to compile TMW without support for OpenGL rendering. To do this perform step 3 as follows: diff --git a/docs/FAQ.txt b/docs/FAQ.txt index 6055513c..2f1eee8b 100644 --- a/docs/FAQ.txt +++ b/docs/FAQ.txt @@ -12,7 +12,7 @@ A: The fastest way is to come on our IRC channel. There you can find a lot of http://forums.themanaworld.org. Ok, do you think forums are evil? Don't worry, send me an e-mail at elvenprogrammer@gmail.com and you're done. That's not enough? No, I won't give you my phone number! ;P - + GAME Q: I always get "Unregistered ID" error message, why? @@ -59,7 +59,7 @@ Q: What's SVN? A: It's a system where is stored the latest development version. It's not assured that it's stable, but surely it has the latest updates. (SVN version is updated quite frequently). If you want to check it out, read this guide - http://themanaworld.org/svn-tutorial.txt + http://themanaworld.org/svn-tutorial.txt DEVELOPMENT @@ -73,18 +73,18 @@ A: We have scheduled releases. Usually a new release is available every month. Q: How can I contribute? A: There are a lot of ways: - + - If you're a programmer, an artist or just willing to help in any way, you can become part of the development team. Send an e-mail to elvenprogrammer@gmail.com explaining what you want to do, or join our irc channel: #themanaworld @ irc.freenode.net. - + - You can donate money. Follow the link on the project page: http://sourceforge.net/projects/themanaworld. - + - You can be a beta tester. Just play with The Mana World and report every error to the tracker. Read for more infos on the project page: http://themanaworld.org. - + - Play with The Mana World: more players, more fun! Simple as that! ;-) diff --git a/docs/INSTALL/win32.txt b/docs/INSTALL/win32.txt index 7f6ee42a..1a1e527f 100644 --- a/docs/INSTALL/win32.txt +++ b/docs/INSTALL/win32.txt @@ -99,11 +99,11 @@ Install them all through the Dev-C++ package manager. **) For PhysFS copy the headers to your include directory, the libs to the lib directory and the dlls (in bin direcotry) to your tmw directory. - + ***) Download developer files and put headers and libs in to include and lib directories of Dev-Cpp. Download binaries and place the dll inside tmw - folder. - + folder. + ****) Get latest win32 - mingw package and install as usual. You should now be fully equipped for compiling the latest TMW development diff --git a/po/POTFILES.in b/po/POTFILES.in index 86b9de67..9d81dc29 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -21,6 +21,7 @@ src/gui/serverdialog.cpp src/gui/setup_audio.cpp src/gui/setup.cpp src/gui/setup_joystick.cpp +src/gui/setup_keyboard.cpp src/gui/setup_video.cpp src/gui/trade.cpp src/resources/itemdb.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 5cf1a6e8..d3926a70 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -250,14 +250,14 @@ tmw_SOURCES = gui/widgets/avatar.cpp \ resources/iteminfo.cpp \ resources/mapreader.cpp \ resources/mapreader.h \ - resources/monsterdb.h \ resources/monsterdb.cpp \ - resources/monsterinfo.h \ + resources/monsterdb.h \ resources/monsterinfo.cpp \ - resources/music.h \ + resources/monsterinfo.h \ resources/music.cpp \ - resources/npcdb.h \ + resources/music.h \ resources/npcdb.cpp \ + resources/npcdb.h \ resources/resource.cpp \ resources/resource.h \ resources/resourcemanager.cpp \ @@ -276,8 +276,8 @@ tmw_SOURCES = gui/widgets/avatar.cpp \ utils/minmax.h \ utils/sha256.h \ utils/sha256.cpp \ - utils/strprintf.h \ utils/strprintf.cpp \ + utils/strprintf.h \ utils/tostring.h \ utils/trim.h \ utils/mutex.h \ diff --git a/src/gui/browserbox.cpp b/src/gui/browserbox.cpp index b0b6f48e..03540d31 100644 --- a/src/gui/browserbox.cpp +++ b/src/gui/browserbox.cpp @@ -142,7 +142,7 @@ void BrowserBox::addRow(const std::string &row) { unsigned int y = 0; unsigned int nextChar; - char const *hyphen = "~"; + const char *hyphen = "~"; int hyphenWidth = font->getWidth(hyphen); int x = 0; diff --git a/src/gui/browserbox.h b/src/gui/browserbox.h index 465ff497..cb4c23ed 100644 --- a/src/gui/browserbox.h +++ b/src/gui/browserbox.h @@ -25,8 +25,8 @@ #include #include -#include #include +#include #include "../guichanfwd.h" #include "../main.h" diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 008c7bb9..cc2262ec 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -165,15 +165,15 @@ void BuyDialog::action(const gcn::ActionEvent &event) Net::GameServer::Player::tradeWithNPC (mShopItems->at(selectedItem)->getId(), mAmountItems); - // Reset selection - mAmountItems = 1; - mSlider->setValue(1); - mSlider->gcn::Slider::setScale(1, mMaxItems); - // Update money and adjust the max number of items that can be bought mMaxItems -= mAmountItems; setMoney(mMoney - mAmountItems * mShopItems->at(selectedItem)->getPrice()); + + // Reset selection + mAmountItems = 1; + mSlider->setValue(1); + mSlider->gcn::Slider::setScale(1, mMaxItems); } } @@ -187,8 +187,7 @@ void BuyDialog::valueChanged(const gcn::SelectionEvent &event) mSlider->gcn::Slider::setScale(1, mMaxItems); } -void -BuyDialog::updateButtonsAndLabels() +void BuyDialog::updateButtonsAndLabels() { const int selectedItem = mShopItemList->getSelected(); int price = 0; diff --git a/src/gui/buy.h b/src/gui/buy.h index 24f18742..a80ffed7 100644 --- a/src/gui/buy.h +++ b/src/gui/buy.h @@ -92,8 +92,7 @@ class BuyDialog : public Window, public gcn::ActionListener, /** * Updates the state of buttons and labels. */ - void - updateButtonsAndLabels(); + void updateButtonsAndLabels(); private: gcn::Button *mBuyButton; diff --git a/src/gui/char_select.cpp b/src/gui/char_select.cpp index 67cb3c7b..f800c266 100644 --- a/src/gui/char_select.cpp +++ b/src/gui/char_select.cpp @@ -134,7 +134,6 @@ CharSelectDialog::CharSelectDialog(LockedArray *charInfo, setVisible(true); mSelectButton->requestFocus(); updatePlayerInfo(); - } void CharSelectDialog::action(const gcn::ActionEvent &event) diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp index 1765eeea..b4a96394 100644 --- a/src/gui/inventorywindow.cpp +++ b/src/gui/inventorywindow.cpp @@ -102,9 +102,8 @@ void InventoryWindow::logic() void InventoryWindow::action(const gcn::ActionEvent &event) { Item *item = mItems->getItem(); - if (!item) { + if (!item) return; - } if (event.getId() == "use") { diff --git a/src/gui/item_amount.cpp b/src/gui/item_amount.cpp index c6763014..cae681d4 100644 --- a/src/gui/item_amount.cpp +++ b/src/gui/item_amount.cpp @@ -75,8 +75,7 @@ ItemAmountWindow::ItemAmountWindow(int usage, Window *parent, Item *item, resetAmount(); - switch (usage) - { + switch (usage) { case AMOUNT_TRADE_ADD: setCaption(_("Select amount of items to trade.")); okButton->setActionEventId("AddTrade"); diff --git a/src/gui/item_amount.h b/src/gui/item_amount.h index dd1026b7..c0d2b2c0 100644 --- a/src/gui/item_amount.h +++ b/src/gui/item_amount.h @@ -38,7 +38,7 @@ class Item; #define AMOUNT_ITEM_SPLIT 3 /** - * Window used for selecting the amount of items to drop. + * Window used for selecting the amount of items to drop, trade or split. * * \ingroup Interface */ diff --git a/src/gui/login.cpp b/src/gui/login.cpp index b4289984..615045b6 100644 --- a/src/gui/login.cpp +++ b/src/gui/login.cpp @@ -38,7 +38,8 @@ #include "../utils/gettext.h" -LoginDialog::LoginDialog(LoginData *loginData) : Window(_("Login")), mLoginData(loginData) +LoginDialog::LoginDialog(LoginData *loginData): + Window(_("Login")), mLoginData(loginData) { gcn::Label *userLabel = new gcn::Label(_("Name:")); gcn::Label *passLabel = new gcn::Label(_("Password:")); diff --git a/src/gui/menuwindow.cpp b/src/gui/menuwindow.cpp index f74dfa41..9415188e 100644 --- a/src/gui/menuwindow.cpp +++ b/src/gui/menuwindow.cpp @@ -58,7 +58,7 @@ MenuWindow::MenuWindow(): setTitleBarHeight(0); // Buttons - static char const *buttonNames[] = + static const char *buttonNames[] = { N_("Status"), N_("Equipment"), diff --git a/src/gui/npc_text.h b/src/gui/npc_text.h index 76161f88..b6eccf95 100644 --- a/src/gui/npc_text.h +++ b/src/gui/npc_text.h @@ -45,7 +45,7 @@ class NpcTextDialog : public Window, public gcn::ActionListener NpcTextDialog(); /** - * Called when resizing the window + * Called when resizing the window. * * @param event The calling event */ diff --git a/src/gui/playerbox.cpp b/src/gui/playerbox.cpp index 0a0c8a17..6888d69a 100644 --- a/src/gui/playerbox.cpp +++ b/src/gui/playerbox.cpp @@ -74,8 +74,7 @@ PlayerBox::~PlayerBox() } } -void -PlayerBox::draw(gcn::Graphics *graphics) +void PlayerBox::draw(gcn::Graphics *graphics) { if (mPlayer) { @@ -87,8 +86,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/popupmenu.cpp b/src/gui/popupmenu.cpp index 59ca0867..a430ff10 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -75,7 +75,6 @@ void PopupMenu::showPopup(int x, int y, Being *being) // add as buddy will be options in this menu. const std::string &name = mBeing->getName(); mBrowserBox->addRow(strprintf(_("@@trade|Trade With %s@@"), name.c_str())); - mBrowserBox->addRow(strprintf(_("@@attack|Attack %s@@"), name.c_str())); //mBrowserBox->addRow("@@follow|Follow " + name + "@@"); //mBrowserBox->addRow("@@buddy|Add " + name + " to Buddy List@@"); diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 24391458..9aee4bee 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -202,8 +202,7 @@ void SellDialog::setMoney(int amount) mShopItemList->setPlayersMoney(amount); } -void -SellDialog::updateButtonsAndLabels() +void SellDialog::updateButtonsAndLabels() { int selectedItem = mShopItemList->getSelected(); int income = 0; @@ -211,7 +210,6 @@ SellDialog::updateButtonsAndLabels() if (selectedItem > -1) { const ItemInfo &info = mShopItems->at(selectedItem)->getInfo(); - mItemDescLabel->setCaption (strprintf(_("Description: %s"), info.getDescription().c_str())); mItemEffectLabel->setCaption diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index e062f674..59b54be0 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -53,7 +53,7 @@ Setup::Setup(): int height = 265; setContentSize(width, height); - static char const *buttonNames[] = { + static const char *buttonNames[] = { N_("Apply"), N_("Cancel"), N_("Reset Windows"), 0 }; int x = width; diff --git a/src/gui/setup_keyboard.cpp b/src/gui/setup_keyboard.cpp index 270f4a0e..e4d1af0c 100644 --- a/src/gui/setup_keyboard.cpp +++ b/src/gui/setup_keyboard.cpp @@ -32,6 +32,7 @@ #include "../configuration.h" #include "../keyboardconfig.h" +#include "../utils/gettext.h" #include "../utils/tostring.h" #include @@ -85,13 +86,13 @@ Setup_Keyboard::Setup_Keyboard(): scrollArea->setDimension(gcn::Rectangle(10, 10, 200, 140)); add(scrollArea); - mAssignKeyButton = new Button("Assign", "assign", this); + mAssignKeyButton = new Button(_("Assign"), "assign", this); mAssignKeyButton->setPosition(165, 155); mAssignKeyButton->addActionListener(this); mAssignKeyButton->setEnabled(false); add(mAssignKeyButton); - mMakeDefaultButton = new Button("Default", "makeDefault", this); + mMakeDefaultButton = new Button(_("Default"), "makeDefault", this); mMakeDefaultButton->setPosition(10, 155); mMakeDefaultButton->addActionListener(this); add(mMakeDefaultButton); @@ -112,8 +113,9 @@ void Setup_Keyboard::apply() if (keyboard.hasConflicts()) { - new OkDialog("Key Conflict(s) Detected.", - "Resolve them, or gameplay may result in strange behaviour."); + new OkDialog(_("Key Conflict(s) Detected."), + _("Resolve them, or gameplay may result in strange " + "behaviour.")); } keyboard.setEnabled(true); keyboard.store(); @@ -171,7 +173,7 @@ void Setup_Keyboard::newKeyCallback(int index) void Setup_Keyboard::refreshKeys() { - for(int i = 0; i < keyboard.KEY_TOTAL; i++) + for (int i = 0; i < keyboard.KEY_TOTAL; i++) { refreshAssignedKey(i); } diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 7d5051c7..0592c485 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -188,9 +188,7 @@ void TradeWindow::action(const gcn::ActionEvent &event) if (event.getId() == "add") { if (!item) - { return; - } if (mMyInventory->contains(item)) { chatWindow->chatLog("Failed adding item. You can not " diff --git a/src/gui/window.cpp b/src/gui/window.cpp index 582e4a67..64607243 100644 --- a/src/gui/window.cpp +++ b/src/gui/window.cpp @@ -31,7 +31,6 @@ #include "window.h" #include "gui.h" -#include "gccontainer.h" #include "windowcontainer.h" #include "widgets/layout.h" @@ -87,8 +86,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent): { logger->log("Window::Window(\"%s\")", caption.c_str()); - if (!windowContainer) - { + if (!windowContainer) { throw GCN_EXCEPTION("Window::Window(): no windowContainer set"); } @@ -128,17 +126,15 @@ Window::Window(const std::string& caption, bool modal, Window *parent): Window::~Window() { logger->log("UNLOAD: Window::~Window(\"%s\")", getCaption().c_str()); - const std::string &name = mWindowName; - if (!name.empty()) - { - // Saving X, Y and Width and Height for resizables in the config + + // Saving X, Y and Width and Height for resizables in the config + if (!name.empty()) { config.setValue(name + "WinX", getX()); config.setValue(name + "WinY", getY()); config.setValue(name + "Visible", isVisible()); - if (mGrip) - { + if (mGrip) { config.setValue(name + "WinWidth", getWidth()); config.setValue(name + "WinHeight", getHeight()); } diff --git a/src/gui/window.h b/src/gui/window.h index 6f49e062..50a206f0 100644 --- a/src/gui/window.h +++ b/src/gui/window.h @@ -222,17 +222,6 @@ class Window : public gcn::Window, gcn::WidgetListener */ void resetToDefaultSize(); - enum ResizeHandles - { - TOP = 0x01, - RIGHT = 0x02, - BOTTOM = 0x04, - LEFT = 0x08 - }; - - /** The window container windows add themselves to. */ - static WindowContainer *windowContainer; - /** * Gets the layout handler for this window. */ @@ -263,7 +252,19 @@ class Window : public gcn::Window, gcn::WidgetListener */ void loadSkin(const std::string &fileName); + protected: + /** The window container windows add themselves to. */ + static WindowContainer *windowContainer; + private: + enum ResizeHandles + { + TOP = 0x01, + RIGHT = 0x02, + BOTTOM = 0x04, + LEFT = 0x08 + }; + /** * Determines if the mouse is in a resize area and returns appropriate * resize handles. Also initializes drag offset in case the resize diff --git a/src/main.cpp b/src/main.cpp index 2d6b08a8..39a0fb37 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -315,7 +315,7 @@ void initEngine(const Options &options) if (!resman->setWriteDir(homeDir)) { std::cout << homeDir - << " couldn't be set as home directory! Exitting." + << " couldn't be set as home directory! Exiting." << std::endl; exit(1); } diff --git a/src/net/messagein.h b/src/net/messagein.h index 444699c8..f2390baa 100644 --- a/src/net/messagein.h +++ b/src/net/messagein.h @@ -61,13 +61,13 @@ class MessageIn * Returns the message length. */ unsigned int - getLength() { return mLength; } + getLength() const { return mLength; } /** * Returns the length of unread data. */ unsigned int - getUnreadLength() { return mLength - mPos; } + getUnreadLength() const { return mLength - mPos; } private: const char* mData; /**< The message data. */ diff --git a/src/net/network.cpp b/src/net/network.cpp index a4ea3def..57e368e2 100644 --- a/src/net/network.cpp +++ b/src/net/network.cpp @@ -83,8 +83,7 @@ Net::Connection *Net::getConnection() return new Net::Connection(client); } -void -Net::registerHandler(MessageHandler *handler) +void Net::registerHandler(MessageHandler *handler) { for (const Uint16 *i = handler->handledMessages; *i; i++) { @@ -92,8 +91,7 @@ Net::registerHandler(MessageHandler *handler) } } -void -Net::unregisterHandler(MessageHandler *handler) +void Net::unregisterHandler(MessageHandler *handler) { for (const Uint16 *i = handler->handledMessages; *i; i++) { @@ -101,8 +99,7 @@ Net::unregisterHandler(MessageHandler *handler) } } -void -Net::clearHandlers() +void Net::clearHandlers() { mMessageHandlers.clear(); } @@ -114,26 +111,25 @@ Net::clearHandlers() */ namespace { - void - dispatchMessage(ENetPacket *packet) - { - MessageIn msg((const char *)packet->data, packet->dataLength); - - MessageHandlerIterator iter = mMessageHandlers.find(msg.getId()); - - if (iter != mMessageHandlers.end()) { - //logger->log("Received packet %x (%i B)", - // msg.getId(), msg.getLength()); - iter->second->handleMessage(msg); - } - else { - logger->log("Unhandled packet %x (%i B)", - msg.getId(), msg.getLength()); - } - - // Clean up the packet now that we're done using it. - enet_packet_destroy(packet); + void dispatchMessage(ENetPacket *packet) + { + MessageIn msg((const char *)packet->data, packet->dataLength); + + MessageHandlerIterator iter = mMessageHandlers.find(msg.getId()); + + if (iter != mMessageHandlers.end()) { + //logger->log("Received packet %x (%i B)", + // msg.getId(), msg.getLength()); + iter->second->handleMessage(msg); } + else { + logger->log("Unhandled packet %x (%i B)", + msg.getId(), msg.getLength()); + } + + // Clean up the packet now that we're done using it. + enet_packet_destroy(packet); + } } void Net::flush() diff --git a/src/resources/npcdb.cpp b/src/resources/npcdb.cpp index 5cd6d20d..2f8d78d4 100644 --- a/src/resources/npcdb.cpp +++ b/src/resources/npcdb.cpp @@ -132,4 +132,3 @@ NPCDB::get(int id) return *(i->second); } } - diff --git a/src/resources/resourcemanager.cpp b/src/resources/resourcemanager.cpp index bebd17f8..3d42d92e 100644 --- a/src/resources/resourcemanager.cpp +++ b/src/resources/resourcemanager.cpp @@ -95,11 +95,15 @@ ResourceManager::~ResourceManager() void ResourceManager::cleanUp(Resource *res) { - logger->log("ResourceManager::~ResourceManager() cleaning up %d " + if (res->mRefCount > 0) + { + logger->log("ResourceManager::~ResourceManager() cleaning up %d " "reference%s to %s", res->mRefCount, (res->mRefCount == 1) ? "" : "s", res->mIdPath.c_str()); + } + delete res; } diff --git a/src/utils/xml.cpp b/src/utils/xml.cpp index 47f1bd04..05df9f1d 100644 --- a/src/utils/xml.cpp +++ b/src/utils/xml.cpp @@ -26,7 +26,7 @@ namespace XML { Document::Document(const std::string &filename): - mDoc(NULL) + mDoc(0) { int size; ResourceManager *resman = ResourceManager::getInstance(); @@ -59,8 +59,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; @@ -73,8 +72,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; @@ -87,8 +85,8 @@ 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) { @@ -108,4 +106,5 @@ namespace XML return NULL; } -} + +} // namespace XML diff --git a/src/utils/xml.h b/src/utils/xml.h index 5a5c756b..d0aba62e 100644 --- a/src/utils/xml.h +++ b/src/utils/xml.h @@ -71,20 +71,18 @@ 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 -- cgit v1.2.3-70-g09d2