diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-01-15 01:07:47 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-01-15 02:05:50 +0200 |
commit | e2150d04662a4ba8b5304dabcc74be0bacded5b7 (patch) | |
tree | cbeb05c2f056a7d5ac4a08e7b80799b5cfd4785b /src | |
parent | edda37acb9d66f2751ef712c83dced62428fa685 (diff) | |
download | manaplus-e2150d04662a4ba8b5304dabcc74be0bacded5b7.tar.gz manaplus-e2150d04662a4ba8b5304dabcc74be0bacded5b7.tar.bz2 manaplus-e2150d04662a4ba8b5304dabcc74be0bacded5b7.tar.xz manaplus-e2150d04662a4ba8b5304dabcc74be0bacded5b7.zip |
Fix code style, apply some fixes after checking with cppcheck from git.
Diffstat (limited to 'src')
66 files changed, 171 insertions, 157 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp index 8b29b91b6..3af80ef0d 100644 --- a/src/actorsprite.cpp +++ b/src/actorsprite.cpp @@ -107,7 +107,7 @@ void ActorSprite::logic() { mMustResetParticles = false; for (std::set<int>::iterator it = mStatusEffects.begin(); - it != mStatusEffects.end(); it++) + it != mStatusEffects.end(); ++it) { const StatusEffect *effect = StatusEffect::getStatusEffect(*it, true); @@ -307,7 +307,7 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, SpriteRefs it, it_end; for (it = display.sprites.begin(), it_end = display.sprites.end(); - it != it_end; it++) + it != it_end; ++it) { std::string file = "graphics/sprites/" + (*it)->sprite; int variant = (*it)->variant; @@ -341,7 +341,7 @@ void ActorSprite::setupSpriteDisplay(const SpriteDisplay &display, { std::list<std::string>::const_iterator it, it_end; for (it = display.particles.begin(), it_end = display.particles.end(); - it != it_end; it++) + it != it_end; ++it) { Particle *p = particleEngine->addEffect(*it, 0, 0); controlParticle(p); diff --git a/src/actorspritemanager.cpp b/src/actorspritemanager.cpp index 01eba1866..6182d81ab 100644 --- a/src/actorspritemanager.cpp +++ b/src/actorspritemanager.cpp @@ -44,7 +44,7 @@ #include <vector> #define for_actors ActorSpritesConstIterator it, it_end; \ -for (it = mActors.begin(), it_end = mActors.end() ; it != it_end; it++) +for (it = mActors.begin(), it_end = mActors.end() ; it != it_end; ++it) class FindBeingFunctor { @@ -268,6 +268,9 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y, return NULL; bool targetDead = mTargetDeadPlayers; + const int xtol = 16; + const int uptol = 32; + for_actors { if ((*it)->getType() == ActorSprite::FLOOR_ITEM @@ -278,9 +281,6 @@ Being *ActorSpriteManager::findBeingByPixel(int x, int y, Being *being = static_cast<Being*>(*it); - int xtol = 16; - int uptol = 32; - if ((being->isAlive() || (targetDead && being->getType() == Being::PLAYER)) && (allPlayers || being != player_node)) @@ -306,6 +306,9 @@ void ActorSpriteManager::findBeingsByPixel(std::list<Being*> &beings, return; bool targetDead = mTargetDeadPlayers; + const int xtol = 16; + const int uptol = 32; + for_actors { if ((*it)->getType() == ActorSprite::FLOOR_ITEM @@ -316,9 +319,6 @@ void ActorSpriteManager::findBeingsByPixel(std::list<Being*> &beings, Being *being = static_cast<Being*>(*it); - int xtol = 16; - int uptol = 32; - if ((being->isAlive() || (targetDead && being->getType() == Being::PLAYER)) && (allPlayers || being != player_node)) @@ -649,7 +649,6 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing, return 0; Being *closestBeing = 0; - int dist = 0; maxDist = maxDist * maxDist; @@ -708,6 +707,8 @@ Being *ActorSpriteManager::findNearestLivingBeing(Being *aroundBeing, } else { + int dist = 0; + for (ActorSprites::const_iterator i = mActors.begin(), i_end = mActors.end(); i != i_end; ++i) @@ -859,7 +860,7 @@ bool ActorSpriteManager::hasActorSprite(ActorSprite *actor) const void ActorSpriteManager::addBlock(Uint32 id) { bool alreadyBlocked(false); - for (int i = 0; i < (int)blockedBeings.size(); i++) + for (int i = 0; i < (int)blockedBeings.size(); ++i) { if (id == blockedBeings.at(i)) { @@ -887,7 +888,7 @@ void ActorSpriteManager::deleteBlock(Uint32 id) bool ActorSpriteManager::isBlocked(Uint32 id) { bool blocked(false); - for (int i = 0; i < (int)blockedBeings.size(); i++) + for (int i = 0; i < (int)blockedBeings.size(); ++i) { if (id == blockedBeings.at(i)) { diff --git a/src/being.cpp b/src/being.cpp index 4f31e402c..30117964f 100644 --- a/src/being.cpp +++ b/src/being.cpp @@ -1915,12 +1915,12 @@ void Being::recalcSpritesOrder() } // logger->log("preparation end"); - int lastRemap = 0; + int lastRemap = -1; int cnt = 0; while (cnt < 15 && lastRemap >= 0) { - int lastRemap = -1; + lastRemap = -1; cnt ++; // logger->log("iteration"); @@ -1968,7 +1968,7 @@ void Being::recalcSpritesOrder() searchSlotValueItr(it, idx, slotRemap, reorder); if (it != slotRemap.end()) { - it ++; + ++ it; if (it != slotRemap.end()) slotRemap.insert(it, val); else diff --git a/src/channelmanager.cpp b/src/channelmanager.cpp index 5bdea4637..261b464f7 100644 --- a/src/channelmanager.cpp +++ b/src/channelmanager.cpp @@ -41,7 +41,7 @@ Channel *ChannelManager::findById(int id) const for (std::list<Channel*>::const_iterator itr = mChannels.begin(), end = mChannels.end(); itr != end; - itr++) + ++itr) { Channel *c = (*itr); if (!c) @@ -63,7 +63,7 @@ Channel *ChannelManager::findByName(const std::string &name) const for (std::list<Channel*>::const_iterator itr = mChannels.begin(), end = mChannels.end(); itr != end; - itr++) + ++itr) { Channel *c = (*itr); if (!c) diff --git a/src/compoundsprite.cpp b/src/compoundsprite.cpp index 9bbc328ac..1cd77415b 100644 --- a/src/compoundsprite.cpp +++ b/src/compoundsprite.cpp @@ -49,7 +49,7 @@ CompoundSprite::CompoundSprite(): CompoundSprite::~CompoundSprite() { SpriteIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) delete (*it); clear(); @@ -65,7 +65,7 @@ bool CompoundSprite::reset() bool ret = false; SpriteIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if (*it) ret |= (*it)->reset(); @@ -80,7 +80,7 @@ bool CompoundSprite::play(std::string action) bool ret = false; SpriteIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if (*it) ret |= (*it)->play(action); @@ -95,7 +95,7 @@ bool CompoundSprite::update(int time) bool ret = false; SpriteIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if (*it) ret |= (*it)->update(time); @@ -132,7 +132,7 @@ bool CompoundSprite::draw(Graphics* graphics, int posX, int posY) const void CompoundSprite::drawSprites(Graphics* graphics, int posX, int posY) const { SpriteConstIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if (*it) { @@ -146,7 +146,7 @@ void CompoundSprite::drawSpritesSDL(Graphics* graphics, int posX, int posY) const { SpriteConstIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if (*it) (*it)->draw(graphics, posX, posY); @@ -158,7 +158,7 @@ int CompoundSprite::getWidth() const Sprite *base = NULL; SpriteConstIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if ((base = (*it))) break; @@ -175,7 +175,7 @@ int CompoundSprite::getHeight() const Sprite *base = NULL; SpriteConstIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if ((base = (*it))) break; @@ -197,7 +197,7 @@ bool CompoundSprite::setDirection(SpriteDirection direction) bool ret = false; SpriteIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if (*it) ret |= (*it)->setDirection(direction); @@ -218,7 +218,7 @@ int CompoundSprite::getNumberOfLayers() const unsigned int CompoundSprite::getCurrentFrame() const { SpriteConstIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if (*it) return (*it)->getCurrentFrame(); @@ -230,7 +230,7 @@ unsigned int CompoundSprite::getCurrentFrame() const unsigned int CompoundSprite::getFrameCount() const { SpriteConstIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if (*it) return (*it)->getFrameCount(); @@ -379,7 +379,7 @@ void CompoundSprite::redraw() const /* SpriteConstIterator it, it_end; - for (it = begin(), it_end = end(); it != it_end; it++) + for (it = begin(), it_end = end(); it != it_end; ++it) { if (*it) (*it)->draw(graphics, posX, posY); diff --git a/src/configuration.cpp b/src/configuration.cpp index 1e79d1e54..3941e6c9b 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -55,7 +55,7 @@ void Configuration::setValue(const std::string &key, const std::string &value) if (list != mListenerMap.end()) { Listeners listeners = list->second; - for (ListenerIterator i = listeners.begin(); i != listeners.end(); i++) + for (ListenerIterator i = listeners.begin(); i != listeners.end(); ++i) (*i)->optionChanged(key); } } @@ -114,7 +114,7 @@ void ConfigurationObject::deleteList(const std::string &name) { for (ConfigurationList::const_iterator it = mContainerOptions[name].begin(); - it != mContainerOptions[name].end(); it++) + it != mContainerOptions[name].end(); ++it) { delete *it; } @@ -126,7 +126,7 @@ void ConfigurationObject::clear() { for (std::map<std::string, ConfigurationList>::const_iterator it = mContainerOptions.begin(); - it != mContainerOptions.end(); it++) + it != mContainerOptions.end(); ++it) { deleteList(it->first); } @@ -143,7 +143,7 @@ void Configuration::cleanDefaults() if (mDefaultsData) { for (DefaultsData::const_iterator iter = mDefaultsData->begin(); - iter != mDefaultsData->end(); iter++) + iter != mDefaultsData->end(); ++iter) { delete(iter->second); } @@ -369,7 +369,7 @@ void ConfigurationObject::writeToXML(xmlTextWriterPtr writer) for (std::map<std::string, ConfigurationList>::const_iterator it = mContainerOptions.begin(); - it != mContainerOptions.end(); it++) + it != mContainerOptions.end(); ++it) { const char *name = it->first.c_str(); @@ -378,7 +378,7 @@ void ConfigurationObject::writeToXML(xmlTextWriterPtr writer) // recurse on all elements for (ConfigurationList::const_iterator elt_it = it->second.begin(); - elt_it != it->second.end(); elt_it++) + elt_it != it->second.end(); ++elt_it) { xmlTextWriterStartElement(writer, BAD_CAST name); (*elt_it)->writeToXML(writer); diff --git a/src/event.cpp b/src/event.cpp index 1a48bddf8..49c79d34e 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -35,7 +35,7 @@ Event::~Event() { delete it->second; it->second = 0; - it++; + ++it; } } @@ -115,7 +115,7 @@ void Event::trigger(Channels channel, const Event &event) while (lit != it->second.end()) { (*lit)->event(channel, event); - lit++; + ++lit; } } @@ -125,7 +125,7 @@ void Event::remove(Listener *listener) while (it != mBindings.end()) { it->second.erase(listener); - it++; + ++it; } } diff --git a/src/filefilter.txt b/src/filefilter.txt index 87431bf29..b2b1e7d0c 100644 --- a/src/filefilter.txt +++ b/src/filefilter.txt @@ -1,5 +1,4 @@ ~ RULE_3_1_A_do_not_start_filename_with_underbar -~ RULE_3_2_B_do_not_use_same_filename_more_than_once ~ RULE_3_2_CD_do_not_use_special_characters_in_filename ~ RULE_3_2_H_do_not_use_uppercase_for_c_filename ~ RULE_3_3_A_start_function_name_with_lowercase_unix diff --git a/src/game.cpp b/src/game.cpp index bf944a710..4f8bad0ce 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -531,7 +531,7 @@ void Game::handleInput() { guiInput->pushInput(event); } - catch (gcn::Exception e) + catch (const gcn::Exception &e) { const char* err = e.getMessage().c_str(); logger->log("Warning: guichan input exception: %s", err); @@ -1076,7 +1076,7 @@ void Game::handleInput() { guiInput->pushInput(event); } - catch (gcn::Exception e) + catch (const gcn::Exception &e) { const char *err = e.getMessage().c_str(); logger->log("Warning: guichan input exception: %s", err); diff --git a/src/gui/botcheckerwindow.cpp b/src/gui/botcheckerwindow.cpp index f7bd7d060..bd721e8aa 100644 --- a/src/gui/botcheckerwindow.cpp +++ b/src/gui/botcheckerwindow.cpp @@ -106,7 +106,7 @@ public: std::set<ActorSprite*> beings = actorSpriteManager->getAll(); ActorSprites::iterator i = beings.begin(); for (ActorSprites::const_iterator i = beings.begin(); - i != beings.end(); i++) + i != beings.end(); ++i) { Being *being = dynamic_cast<Being*>(*i); @@ -246,7 +246,7 @@ public: virtual void freeWidgets() { for (std::vector<gcn::Widget *>::const_iterator it = mWidgets.begin(); - it != mWidgets.end(); it++) + it != mWidgets.end(); ++it) { delete *it; } @@ -393,7 +393,7 @@ void BotCheckerWindow::reset() std::set<ActorSprite*> beings = actorSpriteManager->getAll(); ActorSprites::iterator i = beings.begin(); for (ActorSprites::const_iterator i = beings.begin(); - i != beings.end(); i++) + i != beings.end(); ++i) { Being *being = dynamic_cast<Being*>(*i); diff --git a/src/gui/buy.cpp b/src/gui/buy.cpp index 2be6c65a4..85f1b727c 100644 --- a/src/gui/buy.cpp +++ b/src/gui/buy.cpp @@ -315,7 +315,7 @@ void BuyDialog::closeAll() DialogList::iterator it = instances.begin(); DialogList::iterator it_end = instances.end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) { if (*it) (*it)->close(); diff --git a/src/gui/buysell.cpp b/src/gui/buysell.cpp index f6a1fc193..083a976c2 100644 --- a/src/gui/buysell.cpp +++ b/src/gui/buysell.cpp @@ -129,7 +129,7 @@ void BuySellDialog::closeAll() DialogList::iterator it = instances.begin(); DialogList::iterator it_end = instances.end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) { if (*it) (*it)->close(); diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index ca0f11551..0422570d7 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -540,7 +540,7 @@ void ChatWindow::doPresent() int playercount = 0; for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); - it != it_end; it++) + it != it_end; ++it) { if ((*it)->getType() == ActorSprite::PLAYER) { @@ -654,7 +654,7 @@ void ChatWindow::keyPressed(gcn::KeyEvent &event) mCurHist != mHistory.begin() && !mHistory.empty()) { // Move backward through the history - mCurHist--; + --mCurHist; mChatInput->setText(*mCurHist); mChatInput->setCaretPosition(static_cast<unsigned>( mChatInput->getText().length())); diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 57a94b3d1..054e17584 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -113,7 +113,7 @@ Gui::Gui(Graphics *graphics): { mGuiFont = new TrueTypeFont(fontFile, fontSize); } - catch (gcn::Exception e) + catch (const gcn::Exception &e) { logger->error(std::string("Unable to load '") + fontFile + std::string("': ") + e.getMessage()); @@ -129,7 +129,7 @@ Gui::Gui(Graphics *graphics): mInfoParticleFont = new TrueTypeFont( fontFile, fontSize, TTF_STYLE_BOLD); } - catch (gcn::Exception e) + catch (const gcn::Exception &e) { logger->error(std::string("Unable to load '") + fontFile + std::string("': ") + e.getMessage()); @@ -144,7 +144,7 @@ Gui::Gui(Graphics *graphics): { boldFont = new TrueTypeFont(fontFile, fontSize); } - catch (gcn::Exception e) + catch (const gcn::Exception &e) { logger->error(std::string("Unable to load '") + fontFile + std::string("': ") + e.getMessage()); @@ -159,7 +159,7 @@ Gui::Gui(Graphics *graphics): { mHelpFont = new TrueTypeFont(fontFile, fontSize); } - catch (gcn::Exception e) + catch (const gcn::Exception &e) { logger->error(std::string("Unable to load '") + fontFile + std::string("': ") + e.getMessage()); diff --git a/src/gui/minimap.cpp b/src/gui/minimap.cpp index 6edefcfdd..798318c99 100644 --- a/src/gui/minimap.cpp +++ b/src/gui/minimap.cpp @@ -198,7 +198,7 @@ void Minimap::draw(gcn::Graphics *graphics) const ActorSprites &actors = actorSpriteManager->getAll(); for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); - it != it_end; it++) + it != it_end; ++it) { if (!(*it) || (*it)->getType() == ActorSprite::FLOOR_ITEM) continue; diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp index 6414da6ed..3af0594f6 100644 --- a/src/gui/npcdialog.cpp +++ b/src/gui/npcdialog.cpp @@ -335,7 +335,7 @@ bool NpcDialog::isAnyInputFocused() DialogList::iterator it = instances.begin(); DialogList::iterator it_end = instances.end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) { if ((*it)->isInputFocused()) return true; @@ -403,7 +403,7 @@ NpcDialog *NpcDialog::getActive() DialogList::iterator it = instances.begin(); DialogList::iterator it_end = instances.end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) { if ((*it)->isFocused()) return (*it); @@ -417,7 +417,7 @@ void NpcDialog::closeAll() DialogList::iterator it = instances.begin(); DialogList::iterator it_end = instances.end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) (*it)->close(); } diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index 00bf55028..682a287a4 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -123,6 +123,6 @@ void NpcPostDialog::closeAll() DialogList::iterator it = instances.begin(); DialogList::iterator it_end = instances.end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) (*it)->close(); }
\ No newline at end of file diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index 72c490912..d80bea11f 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -80,7 +80,7 @@ void Palette::advanceGradients() Palettes::iterator it = mInstances.begin(); Palettes::iterator it_end = mInstances.end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) (*it)->advanceGradient(); } diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index 662b184b9..1a164687c 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -260,7 +260,7 @@ void PopupMenu::showPopup(int x, int y, std::list<Being*> &beings) mBrowserBox->clearRows(); mBrowserBox->addRow("Players"); std::list<Being*>::iterator it, it_end; - for (it = beings.begin(), it_end = beings.end(); it != it_end; it++) + for (it = beings.begin(), it_end = beings.end(); it != it_end; ++it) { Being *being = *it; if (!being->getName().empty()) diff --git a/src/gui/quitdialog.cpp b/src/gui/quitdialog.cpp index 7b587dccc..2166902f6 100644 --- a/src/gui/quitdialog.cpp +++ b/src/gui/quitdialog.cpp @@ -179,7 +179,7 @@ void QuitDialog::keyPressed(gcn::KeyEvent &keyEvent) { std::vector<gcn::RadioButton*>::iterator it = mOptions.begin(); - for (; it < mOptions.end(); it++) + for (; it < mOptions.end(); ++it) { if ((*it)->isSelected()) break; diff --git a/src/gui/sell.cpp b/src/gui/sell.cpp index 85577b245..1b149cd48 100644 --- a/src/gui/sell.cpp +++ b/src/gui/sell.cpp @@ -328,6 +328,6 @@ void SellDialog::closeAll() DialogList::iterator it = instances.begin(); DialogList::iterator it_end = instances.end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) (*it)->close(); } diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp index 3556efc35..b31bc7ba8 100644 --- a/src/gui/serverdialog.cpp +++ b/src/gui/serverdialog.cpp @@ -395,7 +395,8 @@ void ServerDialog::action(const gcn::ActionEvent &event) LoginDialog::savedPassword = ""; } - config.setValue("usePersistentIP", mPersistentIPCheckBox->isSelected()); + config.setValue("usePersistentIP", + mPersistentIPCheckBox->isSelected()); Client::setState(STATE_CONNECT_SERVER); } } diff --git a/src/gui/setup.cpp b/src/gui/setup.cpp index 8206b0e7e..f2eff51b0 100644 --- a/src/gui/setup.cpp +++ b/src/gui/setup.cpp @@ -149,7 +149,7 @@ void Setup::action(const gcn::ActionEvent &event) return; for (std::list<Window*>::iterator it = mWindowsToReset.begin(); - it != mWindowsToReset.end(); it++) + it != mWindowsToReset.end(); ++it) { (*it)->resetToDefaultSize(); } @@ -164,7 +164,7 @@ void Setup::setInGame(bool inGame) void Setup::externalUpdate() { for (std::list<SetupTab*>::iterator it = mTabs.begin(); - it != mTabs.end(); it++) + it != mTabs.end(); ++it) { (*it)->externalUpdated(); } diff --git a/src/gui/setup_chat.cpp b/src/gui/setup_chat.cpp index 1dba2ed85..08c76685a 100644 --- a/src/gui/setup_chat.cpp +++ b/src/gui/setup_chat.cpp @@ -55,7 +55,8 @@ #define ACTION_ENABLE_BATTLE_TAB "show battle tab" #define ACTION_SHOW_BATTLE_EVENTS "show battle events" -Setup_Chat::Setup_Chat() +Setup_Chat::Setup_Chat() : + mEditDialog(0) { setName(_("Chat")); diff --git a/src/gui/setup_other.cpp b/src/gui/setup_other.cpp index 5a2b77a81..41a6c41ab 100644 --- a/src/gui/setup_other.cpp +++ b/src/gui/setup_other.cpp @@ -36,7 +36,6 @@ #include "utils/gettext.h" #define ACTION_SHOW_TAKEDDAMAGE "taked damage" -#define ACTION_NO_RAIN "no rain" #define ACTION_ONLY_REACHABLE "only reachable" #define ACTION_ERRORS_IN_DEBUG "errors in debug" #define ACTION_HIGHLIGHT_PORTALS "highlight portals" @@ -68,7 +67,6 @@ Setup_Other::Setup_Other(): mShowMonstersTakedDamage(config.getBoolValue("showMonstersTakedDamage")), mTargetOnlyReachable(config.getBoolValue("targetOnlyReachable")), - mErrorsInDebug(config.getBoolValue("errorsInDebug")), mHighlightPortals(config.getBoolValue("highlightMapPortals")), mHighlightAttackRange(config.getBoolValue("highlightAttackRange")), mHighlightMonsterAttackRange( @@ -89,7 +87,8 @@ Setup_Other::Setup_Other(): mWarpParticle(config.getBoolValue("warpParticle")), mAutoShop(config.getBoolValue("autoShop")), mShowMobHP(config.getBoolValue("showMobHP")), - mShowOwnHP(config.getBoolValue("showOwnHP")) + mShowOwnHP(config.getBoolValue("showOwnHP")), + mEditDialog(0) { setName(_("Misc")); @@ -409,7 +408,6 @@ void Setup_Other::apply() { config.setValue("showMonstersTakedDamage", mShowMonstersTakedDamage); config.setValue("targetOnlyReachable", mTargetOnlyReachable); - config.setValue("errorsInDebug", mErrorsInDebug); config.setValue("highlightMapPortals", mHighlightPortals); config.setValue("highlightAttackRange", mHighlightAttackRange); config.setValue("highlightMonsterAttackRange", diff --git a/src/gui/setup_other.h b/src/gui/setup_other.h index 6a092e93f..4f2930fd3 100644 --- a/src/gui/setup_other.h +++ b/src/gui/setup_other.h @@ -47,18 +47,9 @@ class Setup_Other : public SetupTab, public gcn::ActionListener gcn::CheckBox *mShowMonstersTakedDamageCheckBox; bool mShowMonstersTakedDamage; - gcn::CheckBox *mNoRainCheckBox; - bool mNoRain; - gcn::CheckBox *mTargetOnlyReachableCheckBox; bool mTargetOnlyReachable; - int mOverlayDetail; - gcn::DropDown *mFontSizeDropDown; - - gcn::CheckBox *mErrorsInDebugCheckBox; - bool mErrorsInDebug; - gcn::CheckBox *mHighlightPortalsCheckBox; bool mHighlightPortals; diff --git a/src/gui/shopwindow.cpp b/src/gui/shopwindow.cpp index 410e79dbb..e670e9d15 100644 --- a/src/gui/shopwindow.cpp +++ b/src/gui/shopwindow.cpp @@ -359,7 +359,7 @@ void ShopWindow::saveList() std::vector<ShopItem*> items = mBuyShopItems->items(); std::vector<ShopItem*>::iterator it; - for (it = items.begin(); it != items.end(); it++) + for (it = items.begin(); it != items.end(); ++it) { ShopItem *item = *(it); if (item) @@ -367,7 +367,7 @@ void ShopWindow::saveList() } items = mSellShopItems->items(); - for (it = items.begin(); it != items.end(); it++) + for (it = items.begin(); it != items.end(); ++it) { ShopItem *sellItem = *(it); ShopItem *buyItem = mapItems[sellItem->getId()]; @@ -392,7 +392,7 @@ void ShopWindow::saveList() } std::map<int, ShopItem*>::iterator mapIt; - for (mapIt = mapItems.begin(); mapIt != mapItems.end(); mapIt++) + for (mapIt = mapItems.begin(); mapIt != mapItems.end(); ++mapIt) { ShopItem *buyItem = (*mapIt).second; if (buyItem) @@ -433,7 +433,7 @@ void ShopWindow::announce(ShopItems *list, int mode) std::vector<ShopItem*> items = list->items(); std::vector<ShopItem*>::iterator it; - for (it = items.begin(); it != items.end(); it++) + for (it = items.begin(); it != items.end(); ++it) { ShopItem *item = *(it); if (item->getQuantity() > 1) @@ -499,7 +499,7 @@ void ShopWindow::giveList(const std::string &nick, int mode) std::vector<ShopItem*> items = list->items(); std::vector<ShopItem*>::iterator it; - for (it = items.begin(); it != items.end(); it++) + for (it = items.begin(); it != items.end(); ++it) { ShopItem *item = *(it); if (!item) @@ -752,7 +752,7 @@ bool ShopWindow::findShopItem(ShopItem *shopItem, int mode) items = mBuyShopItems->items(); } - for (it = items.begin(); it != items.end(); it++) + for (it = items.begin(); it != items.end(); ++it) { ShopItem *item = *(it); if (!item) diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp index 04222d6f5..fa4d5bdb2 100644 --- a/src/gui/skilldialog.cpp +++ b/src/gui/skilldialog.cpp @@ -291,7 +291,7 @@ void SkillDialog::update() PlayerInfo::getAttribute(SKILL_POINTS))); mPointsLabel->adjustSize(); - for (SkillMap::iterator it = mSkills.begin(); it != mSkills.end(); it++) + for (SkillMap::iterator it = mSkills.begin(); it != mSkills.end(); ++it) { if ((*it).second && (*it).second->modifiable) (*it).second->update(); @@ -435,7 +435,7 @@ void SkillModel::updateVisibilities() { mVisibleSkills.clear(); - for (SkillList::iterator it = mSkills.begin(); it != mSkills.end(); it++) + for (SkillList::iterator it = mSkills.begin(); it != mSkills.end(); ++it) { if ((*it)->visible) mVisibleSkills.push_back((*it)); diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 7e86e4d9c..97ebcd3b4 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -597,7 +597,7 @@ public: } } - i++; + ++i; idx ++; } if (socialWindow) diff --git a/src/gui/specialswindow.cpp b/src/gui/specialswindow.cpp index bd968191d..baa84a147 100644 --- a/src/gui/specialswindow.cpp +++ b/src/gui/specialswindow.cpp @@ -134,7 +134,7 @@ void SpecialsWindow::draw(gcn::Graphics *graphics) // which match mEntries for (std::map<int, Special>::iterator i = specialData.begin(); - i != specialData.end(); i++) + i != specialData.end(); ++i) { std::map<int, SpecialEntry *>::iterator e = mEntries.find(i->first); if (e == mEntries.end()) @@ -167,7 +167,7 @@ void SpecialsWindow::rebuild(const std::map<int, Special> &specialData) for (std::map<int, Special>::const_iterator i = specialData.begin(); i != specialData.end(); - i++) + ++i) { logger->log("Updating special GUI for %d", i->first); diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp index 349893bfa..02436c179 100644 --- a/src/gui/statuswindow.cpp +++ b/src/gui/statuswindow.cpp @@ -287,7 +287,7 @@ void StatusWindow::event(Channels channel _UNUSED_, mCharacterPointsLabel->adjustSize(); // Update all attributes for (Attrs::iterator it = mAttrs.begin(); - it != mAttrs.end(); it++) + it != mAttrs.end(); ++it) { if (it->second) it->second->update(); @@ -300,7 +300,7 @@ void StatusWindow::event(Channels channel _UNUSED_, mCorrectionPointsLabel->adjustSize(); // Update all attributes for (Attrs::iterator it = mAttrs.begin(); - it != mAttrs.end(); it++) + it != mAttrs.end(); ++it) { if (it->second) it->second->update(); diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index 8e77c1ded..f3ee600d5 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -107,7 +107,7 @@ TrueTypeFont::TrueTypeFont(const std::string &filename, int size, int style) : if (!fontCounter) { strBuf = new char[65535]; - memset(strBuf, 65535, 0); + memset(strBuf, 0, 65535); } ++fontCounter; @@ -280,7 +280,7 @@ int TrueTypeFont::getWidth(const std::string &text) const int cnt = 0; #endif - for (CacheIterator i = cache->begin(); i != cache->end(); i++) + for (CacheIterator i = cache->begin(); i != cache->end(); ++i) { if (i->text == text) { diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index e2bab0621..9458ea911 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -230,7 +230,7 @@ void Viewport::draw(gcn::Graphics *gcnGraphics) // Draw player names, speech, and emotion sprite as needed const ActorSprites &actors = actorSpriteManager->getAll(); for (ActorSpritesConstIterator it = actors.begin(), it_end = actors.end(); - it != it_end; it++) + it != it_end; ++it) { if ((*it)->getType() == ActorSprite::FLOOR_ITEM) continue; diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index acb182c3c..3e3b9f07f 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -178,7 +178,7 @@ void BrowserBox::addRow(const std::string &row, bool atTop) int hyphenWidth = font->getWidth(hyphen); int x = 0; - for (TextRowIterator i = mTextRows.begin(); i != mTextRows.end(); i++) + for (TextRowIterator i = mTextRows.begin(); i != mTextRows.end(); ++i) { std::string row = *i; for (unsigned int j = 0; j < row.size(); j++) @@ -316,7 +316,7 @@ void BrowserBox::draw(gcn::Graphics *graphics) for (LinePartIterator i = mLineParts.begin(); i != mLineParts.end(); - i ++) + ++i) { const LinePart &part = *i; if (part.mY + 50 < mYStart) @@ -347,7 +347,7 @@ int BrowserBox::calcHeight() mLineParts.clear(); - for (TextRowIterator i = mTextRows.begin(); i != mTextRows.end(); i++) + for (TextRowIterator i = mTextRows.begin(); i != mTextRows.end(); ++i) { const std::string row = *(i); bool wrapped = false; diff --git a/src/gui/widgets/flowcontainer.cpp b/src/gui/widgets/flowcontainer.cpp index a93818abc..2154c0958 100644 --- a/src/gui/widgets/flowcontainer.cpp +++ b/src/gui/widgets/flowcontainer.cpp @@ -65,7 +65,7 @@ void FlowContainer::widgetResized(const gcn::Event &event _UNUSED_) int i = 0; height = 0; for (WidgetList::iterator it = mWidgets.begin(); - it != mWidgets.end(); it++) + it != mWidgets.end(); ++it) { int x = i % mGridWidth * mBoxWidth; (*it)->setPosition(x, height); diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index f4e2792ef..d85f57542 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -484,8 +484,11 @@ void ItemContainer::updateMatrix() } } - for (int idx = j * mGridColumns + i; idx < mGridRows * mGridColumns; idx ++) + for (int idx = j * mGridColumns + i; + idx < mGridRows * mGridColumns; idx ++) + { mShowMatrix[idx] = -1; + } for (unsigned idx = 0; idx < sortedItems.size(); idx ++) delete sortedItems[idx]; diff --git a/src/gui/widgets/shortcutcontainer.cpp b/src/gui/widgets/shortcutcontainer.cpp index 167296410..8ce252150 100644 --- a/src/gui/widgets/shortcutcontainer.cpp +++ b/src/gui/widgets/shortcutcontainer.cpp @@ -31,7 +31,13 @@ float ShortcutContainer::mAlpha = 1.0; ShortcutContainer::ShortcutContainer(): mGridWidth(1), - mGridHeight(1) + mGridHeight(1), + mBackgroundImg(0), + mMaxItems(0), + mBoxWidth(1), + mBoxHeight(1), + mCursorPosX(0), + mCursorPosY(0) { } diff --git a/src/gui/widgets/shortcutcontainer.h b/src/gui/widgets/shortcutcontainer.h index 85d08d0b4..11008b4ce 100644 --- a/src/gui/widgets/shortcutcontainer.h +++ b/src/gui/widgets/shortcutcontainer.h @@ -102,7 +102,6 @@ class ShortcutContainer : public gcn::Widget, int getIndexFromGrid(int pointX, int pointY) const; Image *mBackgroundImg; - static float mAlpha; unsigned mMaxItems; diff --git a/src/gui/widgets/tabbedarea.cpp b/src/gui/widgets/tabbedarea.cpp index 232664860..7061f54d6 100644 --- a/src/gui/widgets/tabbedarea.cpp +++ b/src/gui/widgets/tabbedarea.cpp @@ -121,7 +121,7 @@ void TabbedArea::removeTab(Tab *tab) } TabContainer::iterator iter; - for (iter = mTabs.begin(); iter != mTabs.end(); iter++) + for (iter = mTabs.begin(); iter != mTabs.end(); ++iter) { if (iter->first == tab) { @@ -132,7 +132,7 @@ void TabbedArea::removeTab(Tab *tab) } std::vector<gcn::Tab*>::iterator iter2; - for (iter2 = mTabsToDelete.begin(); iter2 != mTabsToDelete.end(); iter2++) + for (iter2 = mTabsToDelete.begin(); iter2 != mTabsToDelete.end(); ++iter2) { if (*iter2 == tab) { diff --git a/src/gui/widgets/tablemodel.cpp b/src/gui/widgets/tablemodel.cpp index f1d583ef6..1b5ec5923 100644 --- a/src/gui/widgets/tablemodel.cpp +++ b/src/gui/widgets/tablemodel.cpp @@ -40,7 +40,7 @@ void TableModel::removeListener(TableModelListener *listener) void TableModel::signalBeforeUpdate() { for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); - it != listeners.end(); it++) + it != listeners.end(); ++it) { (*it)->modelUpdated(false); } @@ -49,7 +49,7 @@ void TableModel::signalBeforeUpdate() void TableModel::signalAfterUpdate() { for (std::set<TableModelListener *>::const_iterator it = listeners.begin(); - it != listeners.end(); it++) + it != listeners.end(); ++it) { if (*it) (*it)->modelUpdated(true); diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index 9a5b2de33..e7c181de2 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -46,7 +46,9 @@ ImageRect TextField::skin; TextField::TextField(const std::string &text, bool loseFocusOnTab, gcn::ActionListener* listener, std::string eventId): gcn::TextField(text), - mNumeric(false) + mNumeric(false), + mMinimum(0), + mMaximum(0) { setFrameSize(2); diff --git a/src/gui/widgets/textpreview.cpp b/src/gui/widgets/textpreview.cpp index bd38d8a80..cf52c30ec 100644 --- a/src/gui/widgets/textpreview.cpp +++ b/src/gui/widgets/textpreview.cpp @@ -34,7 +34,9 @@ float TextPreview::mAlpha = 1.0; TextPreview::TextPreview(const std::string &text): - mText(text) + mText(text), + mShadow(false), + mOutline(false) { mTextAlpha = false; mFont = gui->getFont(); diff --git a/src/inventory.cpp b/src/inventory.cpp index f9956798f..180e09b27 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -186,7 +186,7 @@ void Inventory::distributeSlotsChangedEvent() { InventoryListenerList::const_iterator i = mInventoryListeners.begin(); InventoryListenerList::const_iterator i_end = mInventoryListeners.end(); - for (; i != i_end; i++) + for (; i != i_end; ++i) (*i)->slotsChanged(this); } diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 207e71bf5..67ba0db3c 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -2184,17 +2184,15 @@ void LocalPlayer::crazyMoveA() if (mCrazyMoveState >= mMoveProgram.length()) mCrazyMoveState = 0; - Uint8 dir = 0; - // move command if (mMoveProgram[mCrazyMoveState] == 'm') { - int dx = 0; - int dy = 0; - mCrazyMoveState ++; if (mCrazyMoveState < mMoveProgram.length()) { + int dx = 0; + int dy = 0; + char param = mMoveProgram[mCrazyMoveState++]; if (param == '?') { @@ -2246,6 +2244,8 @@ void LocalPlayer::crazyMoveA() // direction command else if (mMoveProgram[mCrazyMoveState] == 'd') { + Uint8 dir = 0; + mCrazyMoveState ++; if (mCrazyMoveState < mMoveProgram.length()) diff --git a/src/map.cpp b/src/map.cpp index 5dd933f0b..41ad1b960 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -100,7 +100,7 @@ void TileAnimation::update(int ticks) if (img != mLastImage) { for (std::list<std::pair<MapLayer*, int> >::iterator i = - mAffected.begin(); i != mAffected.end(); i++) + mAffected.begin(); i != mAffected.end(); ++i) { i->first->setTile(i->second, img); } @@ -200,7 +200,7 @@ void MapLayer::draw(Graphics *graphics, int startX, int startY, while (ai != actors.end() && (*ai)->getPixelY() <= y32) { (*ai)->draw(graphics, -scrollX, -scrollY); - ai++; + ++ai; } } @@ -302,7 +302,7 @@ void MapLayer::draw(Graphics *graphics, int startX, int startY, while (ai != actors.end()) { (*ai)->draw(graphics, -scrollX, -scrollY); - ai++; + ++ai; } if (mHighlightAttackRange && player_node) { @@ -608,7 +608,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY) || actor->getTileX() > endX || actor->getTileY() < startY || actor->getTileY() > endY)) { - ai++; + ++ai; continue; } // For now, just draw actors with only one layer. @@ -619,7 +619,7 @@ void Map::draw(Graphics *graphics, int scrollX, int scrollY) actor->setAlpha(1.0f); } } - ai++; + ++ai; } } @@ -754,7 +754,7 @@ Tileset *Map::getTilesetWithGid(int gid) const Tileset *s = NULL; for (Tilesets::const_iterator it = mTilesets.begin(), it_end = mTilesets.end(); it < it_end && (*it)->getFirstGid() <= gid; - it++) + ++it) { s = *it; } @@ -803,7 +803,7 @@ bool Map::occupied(int x, int y) const { const ActorSprites &actors = actorSpriteManager->getAll(); ActorSpritesConstIterator it, it_end; - for (it = actors.begin(), it_end = actors.end(); it != it_end; it++) + for (it = actors.begin(), it_end = actors.end(); it != it_end; ++it) { const ActorSprite *actor = *it; diff --git a/src/net/download.cpp b/src/net/download.cpp index 2d391b783..882cc76d3 100644 --- a/src/net/download.cpp +++ b/src/net/download.cpp @@ -71,6 +71,7 @@ Download::Download(void *ptr, const std::string &url, mUrl(url), mFileName(""), mWriteFunction(NULL), + mAdler(0), mUpdateFunction(updateFunction), mThread(NULL), mCurl(NULL), diff --git a/src/net/manaserv/attributes.cpp b/src/net/manaserv/attributes.cpp index 7cc0e053d..7802376ff 100644 --- a/src/net/manaserv/attributes.cpp +++ b/src/net/manaserv/attributes.cpp @@ -93,7 +93,7 @@ namespace Attributes attributeLabels.clear(); AttributeMap::const_iterator it, it_end; for (it = attributes.begin(), it_end = attributes.end(); - it != it_end; it++) + it != it_end; ++it) { if (it->second.modifiable && (it->second.scope == "character" || it->second.scope == "being")) @@ -288,7 +288,7 @@ namespace Attributes unsigned int count = 0; for_each_xml_child_node(effectNode, node) - { + { if (!xmlStrEqual(effectNode->name, BAD_CAST "modifier")) continue; ++count; @@ -307,7 +307,7 @@ namespace Attributes tag = name.substr(0, name.size() > 3 ? 3 : name.size()); tag = toLower(tag) + toString(count); - } + } std::string effect = XML::getProperty( effectNode, "effect", ""); @@ -395,7 +395,7 @@ namespace Attributes AttributeMap::const_iterator it, it_end; for (it = attributes.begin(), it_end = attributes.end(); - it != it_end; it++) + it != it_end; ++it) { if (it->second.playerInfoId == -1 && (it->second.scope == "character" diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp index dd5430c03..adc3b206c 100644 --- a/src/net/manaserv/charhandler.cpp +++ b/src/net/manaserv/charhandler.cpp @@ -321,7 +321,7 @@ void CharHandler::newCharacter(const std::string &name, msg.writeInt8(slot); std::vector<int>::const_iterator it, it_end; - for (it = stats.begin(), it_end = stats.end(); it != it_end; it++) + for (it = stats.begin(), it_end = stats.end(); it != it_end; ++it) msg.writeInt16((*it)); accountServerConnection->send(msg); @@ -382,7 +382,7 @@ void CharHandler::updateCharacters() character->data.mAttributes[CORR_POINTS] = info.correctionPoints; for (CachedAttributes::const_iterator it = info.attribute.begin(), - it_end = info.attribute.end(); it != it_end; it++) + it_end = info.attribute.end(); it != it_end; ++it) { character->data.mStats[i].base = it->second.base; character->data.mStats[i].mod = it->second.mod; diff --git a/src/net/manaserv/loginhandler.cpp b/src/net/manaserv/loginhandler.cpp index 1588d762d..bd67967a0 100644 --- a/src/net/manaserv/loginhandler.cpp +++ b/src/net/manaserv/loginhandler.cpp @@ -58,6 +58,8 @@ LoginHandler::LoginHandler() }; handledMessages = _messages; loginHandler = this; + mMinUserNameLength = 4; + mMaxUserNameLength = 10; } void LoginHandler::handleMessage(Net::MessageIn &msg) @@ -232,7 +234,8 @@ void LoginHandler::handleMessage(Net::MessageIn &msg) std::string captchaURL = msg.readString(); std::string captchaInstructions = msg.readString(); - printf("%s: %s\n", captchaURL.c_str(), captchaInstructions.c_str()); + printf("%s: %s\n", captchaURL.c_str(), + captchaInstructions.c_str()); Client::setState(STATE_REGISTER); } diff --git a/src/net/messagein.cpp b/src/net/messagein.cpp index 0ac391ee2..79beeacf4 100644 --- a/src/net/messagein.cpp +++ b/src/net/messagein.cpp @@ -37,6 +37,7 @@ namespace Net MessageIn::MessageIn(const char *data, unsigned int length): mData(data), mLength(length), + mId(0), mPos(0) { PacketCounters::incInPackets(); diff --git a/src/net/tmwa/buysellhandler.cpp b/src/net/tmwa/buysellhandler.cpp index 84a02e92a..02613cebd 100644 --- a/src/net/tmwa/buysellhandler.cpp +++ b/src/net/tmwa/buysellhandler.cpp @@ -65,6 +65,7 @@ BuySellHandler::BuySellHandler() mNpcId = 0; handledMessages = _messages; buySellHandler = this; + mBuyDialog = 0; } void BuySellHandler::handleMessage(Net::MessageIn &msg) diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp index 5f949ce6e..e35a31898 100644 --- a/src/net/tmwa/gamehandler.cpp +++ b/src/net/tmwa/gamehandler.cpp @@ -59,6 +59,7 @@ GameHandler::GameHandler() }; handledMessages = _messages; gameHandler = this; + mCharID = 0; listen(CHANNEL_GAME); } diff --git a/src/net/tmwa/guildhandler.h b/src/net/tmwa/guildhandler.h index 80b03bd01..d1f19d37c 100644 --- a/src/net/tmwa/guildhandler.h +++ b/src/net/tmwa/guildhandler.h @@ -76,7 +76,7 @@ class GuildHandler : public Net::GuildHandler, public MessageHandler private: // TmwAthena (and eAthena) only supports one guild per player - Guild *mGuild; +// Guild *mGuild; }; } diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp index 186f9ceb3..ad5ff4fff 100644 --- a/src/net/tmwa/inventoryhandler.cpp +++ b/src/net/tmwa/inventoryhandler.cpp @@ -372,9 +372,11 @@ void InventoryHandler::handleMessage(Net::MessageIn &msg) InventoryItems::iterator it = mInventoryItems.begin(); InventoryItems::iterator it_end = mInventoryItems.end(); - for (; it != it_end; it++) + for (; it != it_end; ++it) + { mStorage->setItem((*it).slot, (*it).id, (*it).quantity, (*it).equip); + } mInventoryItems.clear(); if (!mStorageWindow) diff --git a/src/net/tmwa/network.cpp b/src/net/tmwa/network.cpp index 7aa9ad7d2..b96cfd2b5 100644 --- a/src/net/tmwa/network.cpp +++ b/src/net/tmwa/network.cpp @@ -290,12 +290,12 @@ void Network::skip(int len) bool Network::messageReady() { - int len = -1, msgId; + int len = -1; SDL_mutexP(mMutex); if (mInSize >= 2) { - msgId = readWord(0); + int msgId = readWord(0); if (msgId == SMSG_SERVER_VERSION_RESPONSE) len = 10; else diff --git a/src/particle.cpp b/src/particle.cpp index 30ed7ea89..d8b6166a1 100644 --- a/src/particle.cpp +++ b/src/particle.cpp @@ -197,11 +197,11 @@ bool Particle::update() if ((mLifetimePast - 1) % Particle::emitterSkip == 0) { for (EmitterIterator e = mChildEmitters.begin(); - e != mChildEmitters.end(); e++) + e != mChildEmitters.end(); ++e) { Particles newParticles = (*e)->createParticles(mLifetimePast); for (ParticleIterator p = newParticles.begin(); - p != newParticles.end(); p++) + p != newParticles.end(); ++p) { (*p)->moveBy(mPos); mChildParticles.push_back (*p); @@ -237,7 +237,7 @@ bool Particle::update() //update particle if ((*p)->update()) { - p++; + ++p; } else { @@ -255,7 +255,7 @@ void Particle::moveBy(const Vector &change) { mPos += change; for (ParticleIterator p = mChildParticles.begin(); - p != mChildParticles.end(); p++) + p != mChildParticles.end(); ++p) { if ((*p)->doesFollow()) (*p)->moveBy(change); @@ -433,7 +433,7 @@ void Particle::adjustEmitterSize(int w, int h) if (mAllowSizeAdjust) { for (EmitterIterator e = mChildEmitters.begin(); - e != mChildEmitters.end(); e++) + e != mChildEmitters.end(); ++e) { (*e)->adjustSize(w, h); } diff --git a/src/particlecontainer.cpp b/src/particlecontainer.cpp index 68e5f64e4..efb11ab8b 100644 --- a/src/particlecontainer.cpp +++ b/src/particlecontainer.cpp @@ -85,7 +85,7 @@ void ParticleList::removeLocally(Particle *particle) } else { - it++; + ++it; } } } @@ -93,7 +93,7 @@ void ParticleList::removeLocally(Particle *particle) void ParticleList::clearLocally() { for (std::list<Particle *>::iterator it = mElements.begin(); - it != mElements.end(); it++) + it != mElements.end(); ++it) { (*it)->kill(); } @@ -116,7 +116,7 @@ void ParticleList::moveTo(float x, float y) } else { - it++; + ++it; } } } @@ -172,7 +172,7 @@ void ParticleVector::moveTo(float x, float y) ParticleContainer::moveTo(x, y); for (std::vector<Particle *>::iterator it = mIndexedElements.begin(); - it != mIndexedElements.end(); it++) + it != mIndexedElements.end(); ++it) { if (*it) { diff --git a/src/particleemitter.cpp b/src/particleemitter.cpp index 90b29422f..e786e7491 100644 --- a/src/particleemitter.cpp +++ b/src/particleemitter.cpp @@ -401,6 +401,7 @@ ParticleEmitter & ParticleEmitter::operator=(const ParticleEmitter &o) mParticleRotation = o.mParticleRotation; mParticleChildEmitters = o.mParticleChildEmitters; mDeathEffectConditions = o.mDeathEffectConditions; + mDeathEffect = o.mDeathEffect; mOutputPauseLeft = 0; @@ -523,7 +524,7 @@ std::list<Particle *> ParticleEmitter::createParticles(int tick) for (std::list<ParticleEmitter>::iterator i = mParticleChildEmitters.begin(); - i != mParticleChildEmitters.end(); i++) + i != mParticleChildEmitters.end(); ++i) { newParticle->addEmitter(new ParticleEmitter(*i)); } diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp index a9b8c1d28..76cc0debb 100644 --- a/src/playerinfo.cpp +++ b/src/playerinfo.cpp @@ -249,7 +249,7 @@ void logic() { mSpecialRechargeUpdateNeeded = 0; for (SpecialsMap::iterator it = mSpecials.begin(), - it_end = mSpecials.end(); it != it_end; it++) + it_end = mSpecials.end(); it != it_end; ++it) { it->second.currentMana += it->second.recharge; if (it->second.currentMana > it->second.neededMana) diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp index 740da61a6..a5fba5100 100644 --- a/src/playerrelations.cpp +++ b/src/playerrelations.cpp @@ -107,7 +107,7 @@ PlayerRelationsManager::~PlayerRelationsManager() for (std::map<std::string, PlayerRelation *>::const_iterator it = mRelations.begin(); - it != mRelations.end(); it++) + it != mRelations.end(); ++it) { delete it->second; } @@ -117,7 +117,7 @@ void PlayerRelationsManager::clear() { std::vector<std::string> *names = getPlayers(); for (std::vector<std::string>::const_iterator - it = names->begin(); it != names->end(); it++) + it = names->begin(); it != names->end(); ++it) { removePlayer(*it); } @@ -185,7 +185,7 @@ void PlayerRelationsManager::init() } for (std::list<PlayerRelationsListener *>::const_iterator - it = mListeners.begin(); it != mListeners.end(); it++) + it = mListeners.begin(); it != mListeners.end(); ++it) { (*it)->updateAll(); } @@ -215,7 +215,7 @@ void PlayerRelationsManager::signalUpdate(const std::string &name) // store(); for (std::list<PlayerRelationsListener *>::const_iterator - it = mListeners.begin(); it != mListeners.end(); it++) + it = mListeners.begin(); it != mListeners.end(); ++it) { (*it)->updatedPlayer(name); } @@ -325,7 +325,7 @@ std::vector<std::string> * PlayerRelationsManager::getPlayers() for (std::map<std::string, PlayerRelation *>::const_iterator it = mRelations.begin(); - it != mRelations.end(); it++) + it != mRelations.end(); ++it) { if (it->second) retval->push_back(it->first); diff --git a/src/resources/emotedb.cpp b/src/resources/emotedb.cpp index 4d0ba34b4..b786182da 100644 --- a/src/resources/emotedb.cpp +++ b/src/resources/emotedb.cpp @@ -158,7 +158,7 @@ void EmoteDB::unload() { for (EmoteInfos::const_iterator i = mEmoteInfos.begin(); i != mEmoteInfos.end(); - i++) + ++i) { while (!i->second->sprites.empty()) { diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index 3f17c22ad..e2775c8e8 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -205,7 +205,8 @@ void ItemDB::load() std::string drawAfter = XML::getProperty(node, "drawAfter", ""); std::string tags[3]; - tags[0] = XML::getProperty(node, "tag", XML::getProperty(node, "tag1", "")); + tags[0] = XML::getProperty(node, "tag", + XML::getProperty(node, "tag1", "")); tags[1] = XML::getProperty(node, "tag2", ""); tags[2] = XML::getProperty(node, "tag3", ""); @@ -269,7 +270,7 @@ void ItemDB::load() effect += strprintf(gettext(fields[i][1]), value); } for (std::list<Stat>::iterator it = extraStats.begin(); - it != extraStats.end(); it++) + it != extraStats.end(); ++it) { int value = XML::getProperty(node, it->tag.c_str(), 0); if (!value) diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 19bba335d..25a30407a 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -207,7 +207,7 @@ class ItemInfo void setDrawPriority(int n) { mDrawPriority = n; } - std::map<int, int> getTags() + std::map<int, int> getTags() const { return mTags; } void addTag(int tag) @@ -243,7 +243,7 @@ class ItemInfo /** Stores the names of sounds to be played at certain event. */ std::map < EquipmentSoundEvent, std::vector<std::string> > mSounds; - std::map <int,int> mTags; + std::map <int, int> mTags; }; #endif diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index d3ccef38b..3301478e2 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -139,7 +139,7 @@ std::string Wallpaper::getWallpaper(int width, int height) // Wallpaper filename container std::vector<std::string> wallPaperVector; - for (iter = wallpaperData.begin(); iter != wallpaperData.end(); iter++) + for (iter = wallpaperData.begin(); iter != wallpaperData.end(); ++iter) { wp = *iter; if (wp.width <= width && wp.height <= height) diff --git a/src/statuseffect.cpp b/src/statuseffect.cpp index 1a399410b..3f950ed95 100644 --- a/src/statuseffect.cpp +++ b/src/statuseffect.cpp @@ -185,7 +185,7 @@ void unloadMap(std::map<int, StatusEffect *> map) { std::map<int, StatusEffect *>::iterator it; - for (it = map.begin(); it != map.end(); it++) + for (it = map.begin(); it != map.end(); ++it) delete (*it).second; map.clear(); diff --git a/src/utils/stringutils.cpp b/src/utils/stringutils.cpp index f2cbea050..ffce9897e 100644 --- a/src/utils/stringutils.cpp +++ b/src/utils/stringutils.cpp @@ -183,7 +183,7 @@ unsigned long findI(std::string str, std::list<std::string> &list) str = toLower(str); unsigned long idx; for (std::list<std::string>::iterator i = list.begin(); - i != list.end(); i++) + i != list.end(); ++i) { std::string subStr = toLower(*i); idx = str.find(subStr); @@ -362,5 +362,5 @@ void replaceSpecialChars(std::string &text) std::string normalize(const std::string &name) { std::string normalized = name; - return toLower(trim(normalized));; + return toLower(trim(normalized)); } |