From 5d115b5fd4d9915c4e72c33d800ddbd8a48802b5 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Fri, 30 Sep 2011 17:52:22 +0200 Subject: Fixed the negative XP notifications on levelups. This used to have an associated issue but I just can't find it anymore. Reviewed-by: Thorbjorn. --- src/localplayer.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 78395438..494bbb5a 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -1031,10 +1031,27 @@ void LocalPlayer::event(Event::Channel channel, const Event &event) { if (event.getInt("id") == EXP) { - int change = event.getInt("newValue") - - event.getInt("oldValue"); + int change = 0; + int oldXp = event.getInt("oldValue"); + int newXp = event.getInt("newValue"); + + // When the new XP is lower than the old one, + // it means that a new level has been reached. + // Thus, the xp difference can only be obtained + // with the exp needed for the next level. + // The new XP value is then the XP obtained for the new level. + if (newXp < oldXp) + { + change = PlayerInfo::getAttribute(EXP_NEEDED) + - oldXp + newXp; + } + else + { + change = newXp - oldXp; + } - addMessageToQueue(toString(change) + " xp"); + if (change > 0) + addMessageToQueue(toString(change) + " xp"); } } } -- cgit v1.2.3-60-g2f50 From 659b1eac4fc9e733fcfd233020bac78701c30640 Mon Sep 17 00:00:00 2001 From: Yohann Ferreira Date: Sat, 22 Oct 2011 23:57:01 +0200 Subject: Officially added the gender in the manaserv protocol. Reviewed-by: bjorn. --- src/net/manaserv/beinghandler.cpp | 4 ++-- src/net/manaserv/charhandler.cpp | 4 ++-- src/net/manaserv/manaserv_protocol.h | 10 ++++++++++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp index 4d45da8a..3a7fde70 100644 --- a/src/net/manaserv/beinghandler.cpp +++ b/src/net/manaserv/beinghandler.cpp @@ -155,8 +155,8 @@ void BeingHandler::handleBeingEnterMessage(Net::MessageIn &msg) } int hs = msg.readInt8(), hc = msg.readInt8(); being->setSprite(SPRITE_HAIR, hs * -1, ColorDB::get(hc)); - being->setGender(msg.readInt8() == GENDER_MALE ? - GENDER_MALE : GENDER_FEMALE); + being->setGender(msg.readInt8() == ManaServ::GENDER_MALE ? + ::GENDER_MALE : ::GENDER_FEMALE); handleLooks(being, msg); } break; diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index 79f3b35a..33dd94ba 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -101,8 +101,8 @@ void CharHandler::handleCharacterInfo(Net::MessageIn &msg) CachedCharacterInfo info; info.slot = msg.readInt8(); info.name = msg.readString(); - info.gender = msg.readInt8() == GENDER_MALE ? GENDER_MALE : - GENDER_FEMALE; + info.gender = msg.readInt8() == ManaServ::GENDER_MALE ? + ::GENDER_MALE : ::GENDER_FEMALE; info.hairStyle = msg.readInt8(); info.hairColor = msg.readInt8(); info.level = msg.readInt16(); diff --git a/src/net/manaserv/manaserv_protocol.h b/src/net/manaserv/manaserv_protocol.h index 27d7c7b8..9bd94b3e 100644 --- a/src/net/manaserv/manaserv_protocol.h +++ b/src/net/manaserv/manaserv_protocol.h @@ -438,6 +438,16 @@ enum SpriteLayer SPRITE_VECTOREND }; +/** + * Beings Genders + */ +enum BeingGender +{ + GENDER_MALE = 0, + GENDER_FEMALE, + GENDER_UNSPECIFIED +}; + } // namespace ManaServ #endif // MANASERV_PROTOCOL_H -- cgit v1.2.3-60-g2f50 From 9c5791d3e3b413d8b703f1530f67de8936a3434c Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Fri, 21 Oct 2011 20:54:54 +0200 Subject: Fixed a certain class of Doxygen warnings All cases of documentation for non-existing parameters are now fixed. Also marked a few getters as 'const', removed some superfluous 'inline' keywords and removed the unused 'forceQuantity' option from ItemContainer. Reviewed-by: Yohann Ferreira --- src/actorsprite.h | 2 +- src/configuration.h | 12 ++++++------ src/gui/palette.h | 16 ++++++++-------- src/gui/quitdialog.h | 4 ++-- src/gui/setup_players.cpp | 7 +++---- src/gui/specialswindow.h | 5 +++-- src/gui/widgets/chattab.h | 1 - src/gui/widgets/dropdown.h | 4 +--- src/gui/widgets/itemcontainer.cpp | 5 ++--- src/gui/widgets/itemcontainer.h | 8 ++------ src/gui/widgets/shopitems.h | 2 +- src/gui/widgets/spacer.h | 12 ++++++------ src/playerrelations.cpp | 9 +++++---- src/playerrelations.h | 8 ++++---- src/resources/resourcemanager.h | 8 ++++---- src/resources/theme.h | 4 ++-- src/resources/userpalette.h | 3 --- 17 files changed, 50 insertions(+), 60 deletions(-) diff --git a/src/actorsprite.h b/src/actorsprite.h index 81bbd963..af06b478 100644 --- a/src/actorsprite.h +++ b/src/actorsprite.h @@ -185,7 +185,7 @@ protected: /** * Handle an update to a status or stun effect * - * \param The StatusEffect to effect + * \param effect The StatusEffect to effect * \param effectId -1 for stun, otherwise the effect index */ virtual void handleStatusEffect(StatusEffect *effect, int effectId); diff --git a/src/configuration.h b/src/configuration.h index 44ce688d..a675002b 100644 --- a/src/configuration.h +++ b/src/configuration.h @@ -113,9 +113,9 @@ class ConfigurationObject /** * Serialises a container into a list of configuration options * - * \param IT Iterator type over CONT - * \param T Elements that IT iterates over - * \param CONT The associated container type + * \tparam IT Iterator type over CONT + * \tparam T Elements that IT iterates over + * \tparam CONT The associated container type * * \param name Name of the list the elements should be stored under * \param begin Iterator start @@ -151,9 +151,9 @@ class ConfigurationObject /** * Serialises a container into a list of configuration options * - * \param IT Iterator type over CONT - * \param T Elements that IT iterates over - * \param CONT The associated container type + * \tparam IT Iterator type over CONT + * \tparam T Elements that IT iterates over + * \tparam CONT The associated container type * * \param name Name of the list the elements should be read from under * \param empty Initial (empty) container to write to diff --git a/src/gui/palette.h b/src/gui/palette.h index 51cf7d5f..fcee670f 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -70,9 +70,9 @@ class Palette * * @return the requested color */ - inline const gcn::Color &getColor(int type, int alpha = 255) + const gcn::Color &getColor(int type, int alpha = 255) { - gcn::Color* col = &mColors[type].color; + gcn::Color *col = &mColors[type].color; col->a = alpha; return *col; } @@ -84,7 +84,7 @@ class Palette * * @return the gradient type of the color with the given index */ - inline GradientType getGradientType(int type) + GradientType getGradientType(int type) const { return mColors[type].grad; } @@ -96,7 +96,7 @@ class Palette * * @return the color char of the color with the given index */ - inline char getColorChar(int type) + char getColorChar(int type) const { return mColors[type].ch; } @@ -108,8 +108,8 @@ class Palette * * @return the gradient delay of the color with the given index */ - inline int getGradientDelay(int type) - { return mColors[type].delay; } + int getGradientDelay(int type) const + { return mColors[type].delay; } /** * Updates all colors, that are non-static. @@ -147,7 +147,7 @@ class Palette int delay; int committedDelay; - void set(int type, gcn::Color& color, GradientType grad, int delay) + void set(int type, gcn::Color &color, GradientType grad, int delay) { ColorElem::type = type; ColorElem::color = color; @@ -157,7 +157,7 @@ class Palette ColorElem::gradientIndex = rand(); } - inline int getRGB() + int getRGB() const { return (committedColor.r << 16) | (committedColor.g << 8) | committedColor.b; diff --git a/src/gui/quitdialog.h b/src/gui/quitdialog.h index 21fe2f8a..1571c7d1 100644 --- a/src/gui/quitdialog.h +++ b/src/gui/quitdialog.h @@ -41,9 +41,9 @@ class QuitDialog : public Window, public gcn::ActionListener, { public: /** - * Constructor + * Constructor. * - * @pointerToMe will be set to NULL when the QuitDialog is destroyed + * @param pointerToMe will be set to NULL when the QuitDialog is destroyed */ QuitDialog(QuitDialog **pointerToMe); diff --git a/src/gui/setup_players.cpp b/src/gui/setup_players.cpp index 6fab8bd2..e9faaf3a 100644 --- a/src/gui/setup_players.cpp +++ b/src/gui/setup_players.cpp @@ -131,15 +131,14 @@ public: signalBeforeUpdate(); freeWidgets(); - std::vector *player_names = player_relations.getPlayers(); if (mPlayers) delete mPlayers; - mPlayers = player_names; + mPlayers = player_relations.getPlayers(); // set up widgets - for (unsigned int r = 0; r < player_names->size(); ++r) + for (unsigned int r = 0; r < mPlayers->size(); ++r) { - std::string name = (*player_names)[r]; + std::string name = (*mPlayers)[r]; gcn::Widget *widget = new Label(name); mWidgets.push_back(widget); diff --git a/src/gui/specialswindow.h b/src/gui/specialswindow.h index b440ce13..9917acc2 100644 --- a/src/gui/specialswindow.h +++ b/src/gui/specialswindow.h @@ -38,7 +38,8 @@ class TabbedArea; struct SpecialEntry; -class SpecialsWindow : public Window, public gcn::ActionListener { +class SpecialsWindow : public Window, public gcn::ActionListener +{ public: SpecialsWindow(); @@ -51,7 +52,7 @@ class SpecialsWindow : public Window, public gcn::ActionListener { void draw(gcn::Graphics *graphics); - bool hasSpecials() + bool hasSpecials() const { return !mEntries.empty(); } private: diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h index 6d262e11..bc139079 100644 --- a/src/gui/widgets/chattab.h +++ b/src/gui/widgets/chattab.h @@ -45,7 +45,6 @@ class ChatTab : public Tab, public AutoCompleteLister * * @param line Text message. * @param own Type of message (usually the owner-type). - * @param channelName which channel to send the message to. * @param ignoreRecord should this not be recorded? */ void chatLog(std::string line, Own own = BY_SERVER, diff --git a/src/gui/widgets/dropdown.h b/src/gui/widgets/dropdown.h index e0cfd0d7..c7b3cdb1 100644 --- a/src/gui/widgets/dropdown.h +++ b/src/gui/widgets/dropdown.h @@ -41,9 +41,7 @@ class DropDown : public gcn::DropDown * Contructor. * * @param listModel the ListModel to use. - * @param scrollArea the ScrollArea to use. - * @param listBox the listBox to use. - * @see ListModel, ScrollArea, ListBox. + * @see ListModel */ DropDown(gcn::ListModel *listModel = 0); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index 546a16d2..d88a5747 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -52,7 +52,7 @@ static const int BOX_WIDTH = 35; static const int BOX_HEIGHT = 43; -ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity): +ItemContainer::ItemContainer(Inventory *inventory): mInventory(inventory), mGridColumns(1), mGridRows(1), @@ -60,7 +60,6 @@ ItemContainer::ItemContainer(Inventory *inventory, bool forceQuantity): mHighlightedIndex(-1), mLastUsedSlot(-1), mSelectionStatus(SEL_NONE), - mForceQuantity(forceQuantity), mSwapItems(false), mDescItems(false) { @@ -159,7 +158,7 @@ void ItemContainer::draw(gcn::Graphics *graphics) } // Draw item caption std::string caption; - if (item->getQuantity() > 1 || mForceQuantity) + if (item->getQuantity() > 1) caption = toString(item->getQuantity()); else if (item->isEquipped()) caption = "Eq."; diff --git a/src/gui/widgets/itemcontainer.h b/src/gui/widgets/itemcontainer.h index 4d5afde2..0da894ea 100644 --- a/src/gui/widgets/itemcontainer.h +++ b/src/gui/widgets/itemcontainer.h @@ -54,11 +54,8 @@ class ItemContainer : public gcn::Widget, * Constructor. Initializes the graphic. * * @param inventory - * @param gridColumns Amount of columns in grid. - * @param gridRows Amount of rows in grid. - * @param offset Index offset */ - ItemContainer(Inventory *inventory, bool forceQuantity = false); + ItemContainer(Inventory *inventory); virtual ~ItemContainer(); @@ -184,7 +181,6 @@ class ItemContainer : public gcn::Widget, int mSelectedIndex, mHighlightedIndex; int mLastUsedSlot; SelectionState mSelectionStatus; - bool mForceQuantity; bool mSwapItems; bool mDescItems; int mDragPosX, mDragPosY; @@ -201,4 +197,4 @@ class ItemContainer : public gcn::Widget, SelectionListenerList mSelectionListeners; }; -#endif +#endif // ITEMCONTAINER_H diff --git a/src/gui/widgets/shopitems.h b/src/gui/widgets/shopitems.h index 0e95d9a0..f3e774aa 100644 --- a/src/gui/widgets/shopitems.h +++ b/src/gui/widgets/shopitems.h @@ -62,7 +62,7 @@ class ShopItems : public gcn::ListModel * * @param inventoryIndex the inventory index of the item * @param id the id of the item - * @param quantity number of available copies of the item + * @param amount number of available copies of the item * @param price price of the item */ void addItem(int inventoryIndex, int id, int amount, int price); diff --git a/src/gui/widgets/spacer.h b/src/gui/widgets/spacer.h index cc171890..4756b452 100644 --- a/src/gui/widgets/spacer.h +++ b/src/gui/widgets/spacer.h @@ -37,17 +37,17 @@ class Spacer : public gcn::Widget /** * Constructor. * - * @note Can be called empty, will default to a 5x5 px space + * @note Can be called empty, will default to a space of 5x5 pixels. * - * @param w - width in px. - * @param h - height in px. + * @param w width in pixels. + * @param h height in pixels. */ - Spacer(int x = 5, int y = 5); + Spacer(int w = 5, int h = 5); /** - * Draws the Space. + * Draws nothing. */ - void draw(gcn::Graphics *g){} + void draw(gcn::Graphics *g) {} }; #endif // SPACER_H diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index 8b6e6255..4a70e695 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -249,7 +249,7 @@ void PlayerRelationsManager::setRelation(const std::string &player_name, signalUpdate(player_name); } -std::vector * PlayerRelationsManager::getPlayers() +std::vector * PlayerRelationsManager::getPlayers() const { std::vector *retval = new std::vector(); @@ -273,10 +273,11 @@ void PlayerRelationsManager::removePlayer(const std::string &name) } -PlayerRelation::Relation PlayerRelationsManager::getRelation(const std::string &name) +PlayerRelation::Relation PlayerRelationsManager::getRelation(const std::string &name) const { - if (mRelations[name]) - return mRelations[name]->mRelation; + std::map::const_iterator it = mRelations.find(name); + if (it != mRelations.end()) + return it->second->mRelation; return PlayerRelation::NEUTRAL; } diff --git a/src/playerrelations.h b/src/playerrelations.h index d6ca31ad..fd76aa03 100644 --- a/src/playerrelations.h +++ b/src/playerrelations.h @@ -135,7 +135,7 @@ public: /** * Updates the relationship with this player. */ - PlayerRelation::Relation getRelation(const std::string &name); + PlayerRelation::Relation getRelation(const std::string &name) const; /** * Deletes the information recorded for a player. @@ -182,16 +182,16 @@ public: * For a given ignore strategy short name, find the appropriate index in * the ignore strategies vector. * - * \param The short name of the ignore strategy to look up + * \param shortName The short name of the ignore strategy to look up * \return The appropriate index, or -1 */ - int getPlayerIgnoreStrategyIndex(const std::string &shortname); + int getPlayerIgnoreStrategyIndex(const std::string &shortName); /** * Retrieves a sorted vector of all players for which we have any relations * recorded. */ - std::vector *getPlayers(); + std::vector *getPlayers() const; /** * Removes all recorded player info. diff --git a/src/resources/resourcemanager.h b/src/resources/resourcemanager.h index 870182e4..9b40814f 100644 --- a/src/resources/resourcemanager.h +++ b/src/resources/resourcemanager.h @@ -128,11 +128,11 @@ class ResourceManager /** * Adds a preformatted resource to the resource map. * - * @param path The file name. - * @param Resource The Resource to add. - * @return true if successfull, false otherwise. + * @param idPath The resource identifier path. + * @param resource The Resource to add. + * @return true if successful, false otherwise. */ - bool addResource(const std::string &idPath, Resource* resource); + bool addResource(const std::string &idPath, Resource *resource); /** * Copies a file from one place to another (useful for extracting diff --git a/src/resources/theme.h b/src/resources/theme.h index d6d660e2..57274291 100644 --- a/src/resources/theme.h +++ b/src/resources/theme.h @@ -183,12 +183,12 @@ class Theme : public Palette, public EventListener * * @return the requested color */ - inline static const gcn::Color &getThemeColor(int type, int alpha = 255) + static const gcn::Color &getThemeColor(int type, int alpha = 255) { return mInstance->getColor(type, alpha); } - const static gcn::Color &getThemeColor(char c, bool &valid) + static const gcn::Color &getThemeColor(char c, bool &valid) { return mInstance->getColor(c, valid); } diff --git a/src/resources/userpalette.h b/src/resources/userpalette.h index 01f66ca7..1dd5cf6a 100644 --- a/src/resources/userpalette.h +++ b/src/resources/userpalette.h @@ -114,8 +114,6 @@ class UserPalette : public Palette, public gcn::ListModel /** * Sets the gradient delay for the specified color. - * - * @param grad gradient type to set */ void setGradientDelay(int type, int delay) { mColors[type].delay = delay; } @@ -191,7 +189,6 @@ class UserPalette : public Palette, public gcn::ListModel /** * Initialise color * - * @param c character that needs initialising * @param rgb default color if not found in config * @param text identifier of color */ -- cgit v1.2.3-60-g2f50 From 8954a7ca0f70bbf167c9119d26c7bca8407e8da6 Mon Sep 17 00:00:00 2001 From: Bernd Wachter Date: Mon, 24 Oct 2011 20:28:15 +0300 Subject: Change the wrong, but mostly supported WIN32 macro to the correct _WIN32, enforced by -std=c++0x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Thorbjørn Lindeijer --- libs/enet/include/enet/enet.h | 2 +- libs/enet/protocol.c | 4 ++-- libs/enet/unix.c | 2 +- libs/enet/win32.c | 2 +- mana.cbp | 1 - src/chatlog.cpp | 4 ++-- src/client.cpp | 18 +++++++++--------- src/gui/setup_video.cpp | 4 ++-- src/log.cpp | 4 ++-- src/main.cpp | 4 ++-- src/main.h | 2 +- src/utils/copynpaste.cpp | 2 +- src/utils/mkdir.cpp | 8 ++++---- src/utils/specialfolder.cpp | 2 +- src/utils/specialfolder.h | 2 +- 15 files changed, 30 insertions(+), 31 deletions(-) diff --git a/libs/enet/include/enet/enet.h b/libs/enet/include/enet/enet.h index 02dc2c0a..c5338676 100644 --- a/libs/enet/include/enet/enet.h +++ b/libs/enet/include/enet/enet.h @@ -12,7 +12,7 @@ extern "C" #include -#ifdef WIN32 +#ifdef _WIN32 #include "enet/win32.h" #else #include "enet/unix.h" diff --git a/libs/enet/protocol.c b/libs/enet/protocol.c index d7c3fede..b51ab469 100644 --- a/libs/enet/protocol.c +++ b/libs/enet/protocol.c @@ -1575,7 +1575,7 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch enet_uint32 packetLoss = currentPeer -> packetsLost * ENET_PEER_PACKET_LOSS_SCALE / currentPeer -> packetsSent; #ifdef ENET_DEBUG -#ifdef WIN32 +#ifdef _WIN32 printf ( #else fprintf (stderr, @@ -1625,7 +1625,7 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch host -> headerFlags |= ENET_PROTOCOL_HEADER_FLAG_COMPRESSED; shouldCompress = compressedSize; #ifdef ENET_DEBUG_COMPRESS -#ifdef WIN32 +#ifdef _WIN32 printf ( #else fprintf (stderr, diff --git a/libs/enet/unix.c b/libs/enet/unix.c index 69715413..75c78bc8 100644 --- a/libs/enet/unix.c +++ b/libs/enet/unix.c @@ -2,7 +2,7 @@ @file unix.c @brief ENet Unix system specific functions */ -#ifndef WIN32 +#ifndef _WIN32 #include #include diff --git a/libs/enet/win32.c b/libs/enet/win32.c index e1fae233..0b32e633 100644 --- a/libs/enet/win32.c +++ b/libs/enet/win32.c @@ -2,7 +2,7 @@ @file win32.c @brief ENet Win32 system specific functions */ -#ifdef WIN32 +#ifdef _WIN32 #include #define ENET_BUILDING_LIB 1 diff --git a/mana.cbp b/mana.cbp index fa4495c0..4261269f 100644 --- a/mana.cbp +++ b/mana.cbp @@ -22,7 +22,6 @@ - diff --git a/src/chatlog.cpp b/src/chatlog.cpp index f33b1aff..011fa3aa 100644 --- a/src/chatlog.cpp +++ b/src/chatlog.cpp @@ -29,7 +29,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #elif defined __APPLE__ #include @@ -167,7 +167,7 @@ void ChatLogger::setServerName(const std::string &serverName) void ChatLogger::makeDir(const std::string &dir) { -#ifdef WIN32 +#ifdef _WIN32 mkdir(dir.c_str()); #else mkdir(dir.c_str(), 0750); diff --git a/src/client.cpp b/src/client.cpp index 5736cec4..642d9376 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -86,7 +86,7 @@ #include #include -#ifdef WIN32 +#ifdef _WIN32 #include #include "utils/specialfolder.h" #else @@ -278,7 +278,7 @@ Client::Client(const Options &options): std::string path = options.brandingPath; // Strip blah.mana from the path -#ifdef WIN32 +#ifdef _WIN32 int loc1 = path.find_last_of('/'); int loc2 = path.find_last_of('\\'); int loc = std::max(loc1, loc2); @@ -297,14 +297,14 @@ Client::Client(const Options &options): resman->addToSearchPath(mLocalDataDir, false); std::string iconFile = branding.getValue("appIcon", "icons/mana"); -#ifdef WIN32 +#ifdef _WIN32 iconFile += ".ico"; #else iconFile += ".png"; #endif iconFile = resman->getPath(iconFile); logger->log("Loading icon from file: %s", iconFile.c_str()); -#ifdef WIN32 +#ifdef _WIN32 static SDL_SysWMinfo pInfo; SDL_GetWMInfo(&pInfo); // Attempt to load icon from .ico file @@ -1069,7 +1069,7 @@ void Client::action(const gcn::ActionEvent &event) void Client::initRootDir() { mRootDir = PHYSFS_getBaseDir(); -#ifdef WIN32 +#ifdef _WIN32 std::string portableName = mRootDir + "portable.xml"; struct stat statbuf; @@ -1135,7 +1135,7 @@ void Client::initHomeDir() #elif defined __HAIKU__ mLocalDataDir = std::string(PHYSFS_getUserDir()) + "/config/data/Mana"; -#elif defined WIN32 +#elif defined _WIN32 mLocalDataDir = getSpecialFolderLocation(CSIDL_LOCAL_APPDATA); if (mLocalDataDir.empty()) mLocalDataDir = std::string(PHYSFS_getUserDir()); @@ -1163,7 +1163,7 @@ void Client::initHomeDir() mConfigDir = std::string(PHYSFS_getUserDir()) + "/config/settings/Mana" + branding.getValue("appName", "manasource"); -#elif defined WIN32 +#elif defined _WIN32 mConfigDir = getSpecialFolderLocation(CSIDL_APPDATA); if (mConfigDir.empty()) mConfigDir = mLocalDataDir; @@ -1315,7 +1315,7 @@ void Client::initUpdatesDir() { if (!resman->mkdir("/" + mUpdatesDir)) { -#if defined WIN32 +#if defined _WIN32 std::string newDir = mLocalDataDir + "\\" + mUpdatesDir; std::string::size_type loc = newDir.find("/", 0); @@ -1351,7 +1351,7 @@ void Client::initScreenshotDir() } else if (mScreenshotDir.empty()) { -#ifdef WIN32 +#ifdef _WIN32 mScreenshotDir = getSpecialFolderLocation(CSIDL_MYPICTURES); if (mScreenshotDir.empty()) mScreenshotDir = getSpecialFolderLocation(CSIDL_DESKTOP); diff --git a/src/gui/setup_video.cpp b/src/gui/setup_video.cpp index d72b402b..ea5dc140 100644 --- a/src/gui/setup_video.cpp +++ b/src/gui/setup_video.cpp @@ -301,7 +301,7 @@ void Setup_Video::apply() * See http://libsdl.org/cgi/docwiki.cgi/SDL_SetVideoMode */ -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) // checks for opengl usage if (!config.getBoolValue("opengl")) { @@ -327,7 +327,7 @@ void Setup_Video::apply() logger->error(errorMessage.str()); } } -#if defined(WIN32) || defined(__APPLE__) +#if defined(_WIN32) || defined(__APPLE__) } else { diff --git a/src/log.cpp b/src/log.cpp index bb8a78bb..f430589b 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -21,7 +21,7 @@ #include "log.h" -#ifdef WIN32 +#ifdef _WIN32 #include #elif __APPLE__ #include @@ -106,7 +106,7 @@ void Logger::log(const char *log_text, ...) void Logger::error(const std::string &error_text) { log("Error: %s", error_text.c_str()); -#ifdef WIN32 +#ifdef _WIN32 MessageBox(NULL, error_text.c_str(), "Error", MB_ICONERROR | MB_OK); #elif defined __APPLE__ Str255 msg; diff --git a/src/main.cpp b/src/main.cpp index 08ae4a8c..fccc4c9d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -165,14 +165,14 @@ static void parseOptions(int argc, char *argv[], Client::Options &options) } } -#ifdef WIN32 +#ifdef _WIN32 extern "C" char const *_nl_locale_name_default(void); #endif static void initInternationalization() { #if ENABLE_NLS -#ifdef WIN32 +#ifdef _WIN32 SetEnvironmentVariable("LANG", _nl_locale_name_default()); // mingw doesn't like LOCALEDIR to be defined for some reason bindtextdomain("mana", "translations/"); diff --git a/src/main.h b/src/main.h index 82ece500..169ee7d1 100644 --- a/src/main.h +++ b/src/main.h @@ -52,7 +52,7 @@ #ifdef HAVE_CONFIG_H #include "../config.h" -#elif defined WIN32 +#elif defined _WIN32 #include "winver.h" #elif defined __APPLE__ #define PACKAGE_VERSION "0.5.3" diff --git a/src/utils/copynpaste.cpp b/src/utils/copynpaste.cpp index 3d2e3b80..458a6d27 100644 --- a/src/utils/copynpaste.cpp +++ b/src/utils/copynpaste.cpp @@ -35,7 +35,7 @@ #include #include "copynpaste.h" -#ifdef WIN32 +#ifdef _WIN32 bool RetrieveBuffer(std::string& text, std::string::size_type& pos) { bool ret = false; diff --git a/src/utils/mkdir.cpp b/src/utils/mkdir.cpp index 75ab8595..ee40488e 100644 --- a/src/utils/mkdir.cpp +++ b/src/utils/mkdir.cpp @@ -22,7 +22,7 @@ #include #include -#if defined WIN32 +#if defined _WIN32 #include #endif @@ -51,7 +51,7 @@ int mkdir_r(const char *pathname) { } for (p=tmp; *p; p++) { -#if defined WIN32 +#if defined _WIN32 if (*p == '/' || *p == '\\') #else if (*p == '/') @@ -77,13 +77,13 @@ int mkdir_r(const char *pathname) { return -1; } -#if defined WIN32 +#if defined _WIN32 if (!CreateDirectory(tmp, 0)) #else if (mkdir(tmp, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH)) #endif { -#if defined WIN32 +#if defined _WIN32 // hack, hack. just assume that x: might be a drive // letter, and try again if (!(strlen(tmp) == 2 && diff --git a/src/utils/specialfolder.cpp b/src/utils/specialfolder.cpp index 63337578..0c82ce68 100644 --- a/src/utils/specialfolder.cpp +++ b/src/utils/specialfolder.cpp @@ -18,7 +18,7 @@ * along with this program. If not, see . */ -#ifdef WIN32 +#ifdef _WIN32 #include "specialfolder.h" #include diff --git a/src/utils/specialfolder.h b/src/utils/specialfolder.h index eef6416b..0c3e999c 100644 --- a/src/utils/specialfolder.h +++ b/src/utils/specialfolder.h @@ -21,7 +21,7 @@ #ifndef SPECIALFOLDER_H #define SPECIALFOLDER_H -#ifdef WIN32 +#ifdef _WIN32 #include #include std::string getSpecialFolderLocation(int folderId); -- cgit v1.2.3-60-g2f50