From 3c404128c4669a1f4f190e20a89553677717fc50 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 23 Sep 2016 22:01:44 +0300 Subject: Add missing comments into defines. --- src/gui/dialogsmanager.cpp | 18 +++++----- src/gui/fonts/font.cpp | 30 ++++++++++------ src/gui/fonts/font.h | 2 +- src/gui/fonts/textchunk.cpp | 19 +++++----- src/gui/fonts/textchunk.h | 2 +- src/gui/gui.cpp | 24 +++++++------ src/gui/gui.h | 7 ++-- src/gui/models/modelistmodel.cpp | 6 ++-- src/gui/models/modelistmodel.h | 2 +- src/gui/models/typelistmodel.h | 4 +-- src/gui/popupmanager.cpp | 14 ++++---- src/gui/popups/beingpopup.cpp | 2 +- src/gui/popups/beingpopup.h | 2 +- src/gui/popups/popupmenu.cpp | 12 +++---- src/gui/sdlinput.cpp | 53 ++++++++++++++++----------- src/gui/setupactiondata.h | 2 +- src/gui/widgets/browserbox.cpp | 3 +- src/gui/widgets/inttextfield.cpp | 5 +-- src/gui/widgets/scrollarea.cpp | 6 ++-- src/gui/widgets/tabs/chat/chattab.cpp | 2 +- src/gui/widgets/tabs/debugwindowtabs.cpp | 31 ++++++++-------- src/gui/widgets/tabs/debugwindowtabs.h | 5 +-- src/gui/widgets/tabs/setup_audio.cpp | 2 +- src/gui/widgets/tabs/setup_other.cpp | 4 +-- src/gui/widgets/tabs/setup_perfomance.cpp | 4 +-- src/gui/widgets/tabs/setup_video.cpp | 31 +++++++++------- src/gui/widgets/tabs/setup_video.h | 3 +- src/gui/widgets/tabs/setup_visual.cpp | 6 ++-- src/gui/widgets/textfield.cpp | 18 ++++++---- src/gui/widgets/textfield.h | 5 +-- src/gui/widgets/window.cpp | 12 +++---- src/gui/widgets/window.h | 2 +- src/gui/widgets/windowcontainer.cpp | 2 +- src/gui/widgets/windowcontainer.h | 2 +- src/gui/windowmanager.cpp | 59 ++++++++++++++++++------------- src/gui/windowmanager.h | 2 +- src/gui/windowmanager_unittest.cc | 6 ++-- src/gui/windowmenu.cpp | 12 ++++--- src/gui/windowmenu.h | 2 +- src/gui/windows/buydialog.cpp | 2 +- src/gui/windows/chatwindow.cpp | 8 +++-- src/gui/windows/chatwindow.h | 2 +- src/gui/windows/debugwindow.cpp | 2 +- src/gui/windows/debugwindow.h | 2 +- src/gui/windows/editserverdialog.cpp | 6 ++-- src/gui/windows/itemamountwindow.h | 2 +- src/gui/windows/killstats.cpp | 2 +- src/gui/windows/logindialog.cpp | 6 ++-- src/gui/windows/ministatuswindow.cpp | 2 +- src/gui/windows/ministatuswindow.h | 2 +- src/gui/windows/serverdialog.cpp | 8 +++-- src/gui/windows/shopwindow.cpp | 14 ++++---- src/gui/windows/shopwindow.h | 5 +-- src/gui/windows/shortcutwindow.cpp | 2 +- src/gui/windows/shortcutwindow.h | 2 +- src/gui/windows/socialwindow.cpp | 14 ++++---- src/gui/windows/socialwindow.h | 2 +- src/gui/windows/textcommandeditor.cpp | 37 +++++++++---------- src/gui/windows/textcommandeditor.h | 13 ++++--- src/gui/windows/updaterwindow.cpp | 6 ++-- src/gui/windows/whoisonline.cpp | 19 +++++----- src/gui/windows/whoisonline.h | 4 +-- 62 files changed, 331 insertions(+), 254 deletions(-) (limited to 'src/gui') diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp index ec4da8119..9cfc69342 100644 --- a/src/gui/dialogsmanager.cpp +++ b/src/gui/dialogsmanager.cpp @@ -39,7 +39,7 @@ #include "gui/windows/updaterwindow.h" #include "listeners/playerpostdeathlistener.h" -#endif +#endif // DYECMD #include "listeners/weightlistener.h" @@ -53,7 +53,7 @@ #ifdef WIN32 #undef ERROR -#endif +#endif // WIN32 OkDialog *deathNotice = nullptr; DialogsManager *dialogsManager = nullptr; @@ -66,7 +66,7 @@ namespace PlayerPostDeathListener postDeathListener; WeightListener weightListener; } // namespace -#endif +#endif // DYECMD DialogsManager::DialogsManager() : AttributeListener(), @@ -84,7 +84,8 @@ void DialogsManager::closeDialogs() SellDialog::closeAll(); if (inventoryHandler) inventoryHandler->destroyStorage(); -#endif +#endif // DYECMD + if (deathNotice) { deathNotice->scheduleDelete(); @@ -100,7 +101,7 @@ void DialogsManager::createUpdaterWindow() settings.oldUpdates, false, UpdateType::Normal); -#endif +#endif // DYECMD } Window *DialogsManager::openErrorDialog(const std::string &header, @@ -153,7 +154,7 @@ void DialogsManager::playerDeath() 260); deathNotice->addActionListener(&postDeathListener); } -#endif +#endif // DYECMD } #ifndef DYECMD @@ -211,10 +212,11 @@ void DialogsManager::attributeChanged(const AttributesT id, } } } -#else +#else // DYECMD + void DialogsManager::attributeChanged(const AttributesT id A_UNUSED, const int oldVal A_UNUSED, const int newVal A_UNUSED) { } -#endif +#endif // DYECMD diff --git a/src/gui/fonts/font.cpp b/src/gui/fonts/font.cpp index 7bc0c5357..93356fefd 100644 --- a/src/gui/fonts/font.cpp +++ b/src/gui/fonts/font.cpp @@ -247,12 +247,14 @@ void Font::drawString(Graphics *const graphics, { #ifdef DEBUG_FONT_COUNTERS mDeleteCounter ++; -#endif +#endif // DEBUG_FONT_COUNTERS + cache->removeBack(); } #ifdef DEBUG_FONT_COUNTERS mCreateCounter ++; -#endif +#endif // DEBUG_FONT_COUNTERS + TextChunk *chunk2 = new TextChunk(text, col, col2, this); chunk2->generate(mFont, alpha); @@ -321,36 +323,40 @@ void Font::doClean() const size_t size = CAST_SIZE(cache->size); #ifdef DEBUG_FONT_COUNTERS logger->log("ptr: %u, size: %ld", f, size); -#endif +#endif // DEBUG_FONT_COUNTERS + if (size > CACHE_SIZE_SMALL3) { #ifdef DEBUG_FONT_COUNTERS mDeleteCounter += 100; -#endif +#endif // DEBUG_FONT_COUNTERS + cache->removeBack(100); #ifdef DEBUG_FONT_COUNTERS logger->log("delete3"); -#endif +#endif // DEBUG_FONT_COUNTERS } else if (size > CACHE_SIZE_SMALL2) { #ifdef DEBUG_FONT_COUNTERS mDeleteCounter += 20; -#endif +#endif // DEBUG_FONT_COUNTERS + cache->removeBack(20); #ifdef DEBUG_FONT_COUNTERS logger->log("delete2"); -#endif +#endif // DEBUG_FONT_COUNTERS } else if (size > CACHE_SIZE_SMALL1) { #ifdef DEBUG_FONT_COUNTERS mDeleteCounter ++; -#endif +#endif // DEBUG_FONT_COUNTERS + cache->removeBack(); #ifdef DEBUG_FONT_COUNTERS logger->log("delete1"); -#endif +#endif // DEBUG_FONT_COUNTERS } } } @@ -405,12 +411,14 @@ void Font::generate(TextChunk &chunk) { #ifdef DEBUG_FONT_COUNTERS mDeleteCounter ++; -#endif +#endif // DEBUG_FONT_COUNTERS + cache->removeBack(); } #ifdef DEBUG_FONT_COUNTERS mCreateCounter ++; -#endif +#endif // DEBUG_FONT_COUNTERS + const float alpha = static_cast(chunk.color.a) / 255.0F; chunk.generate(mFont, alpha); // logger->log("generate image: " + chunk.text); diff --git a/src/gui/fonts/font.h b/src/gui/fonts/font.h index d8e16936f..302980b93 100644 --- a/src/gui/fonts/font.h +++ b/src/gui/fonts/font.h @@ -150,6 +150,6 @@ class Font final #ifdef UNITTESTS extern int textChunkCnt; -#endif +#endif // UNITTESTS #endif // GUI_FONTS_FONT_H diff --git a/src/gui/fonts/textchunk.cpp b/src/gui/fonts/textchunk.cpp index 06e649bf4..3025305fd 100644 --- a/src/gui/fonts/textchunk.cpp +++ b/src/gui/fonts/textchunk.cpp @@ -46,7 +46,7 @@ char *restrict strBuf = nullptr; #ifdef UNITTESTS int textChunkCnt = 0; -#endif +#endif // UNITTESTS TextChunk::TextChunk() : img(nullptr), @@ -59,7 +59,7 @@ TextChunk::TextChunk() : { #ifdef UNITTESTS textChunkCnt ++; -#endif +#endif // UNITTESTS } TextChunk::TextChunk(const std::string &restrict text0, @@ -76,7 +76,7 @@ TextChunk::TextChunk(const std::string &restrict text0, { #ifdef UNITTESTS textChunkCnt ++; -#endif +#endif // UNITTESTS } TextChunk::~TextChunk() @@ -84,7 +84,7 @@ TextChunk::~TextChunk() delete2(img); #ifdef UNITTESTS textChunkCnt --; -#endif +#endif // UNITTESTS } bool TextChunk::operator==(const TextChunk &restrict chunk) const @@ -103,9 +103,10 @@ void TextChunk::generate(TTF_Font *restrict const font, sdlCol.g = CAST_U8(color.g); #ifdef USE_SDL2 sdlCol.a = 255; -#else +#else // USE_SDL2 + sdlCol.unused = 0; -#endif +#endif // USE_SDL2 getSafeUtf8String(text, strBuf); @@ -140,9 +141,11 @@ void TextChunk::generate(TTF_Font *restrict const font, sdlCol2.g = CAST_U8(color2.g); #ifdef USE_SDL2 sdlCol2.a = 255; -#else +#else // USE_SDL2 + sdlCol2.unused = 0; -#endif +#endif // USE_SDL2 + SDL_Surface *const surface2 = MTTF_RenderUTF8_Blended( font, strBuf, sdlCol2); if (!surface2) diff --git a/src/gui/fonts/textchunk.h b/src/gui/fonts/textchunk.h index e2151bac2..8cb1df9f2 100644 --- a/src/gui/fonts/textchunk.h +++ b/src/gui/fonts/textchunk.h @@ -67,6 +67,6 @@ class TextChunk final #ifdef UNITTESTS extern int textChunkCnt; -#endif +#endif // UNITTESTS #endif // GUI_FONTS_TEXTCHUNK_H diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 17c3558ae..c4c6a1794 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -78,9 +78,9 @@ #ifndef DYECMD #include "dragdrop.h" -#else +#else // DYECMD #include "resources/image/image.h" -#endif +#endif // DYECMD #include "settings.h" #include "listeners/focuslistener.h" @@ -135,7 +135,7 @@ Gui::Gui() : #ifdef ANDROID mLastMouseRealX(0), mLastMouseRealY(0), -#endif +#endif // ANDROID mFocusListeners(), mForegroundColor(theme->getColor(ThemeColorId::TEXT, 255)), mForegroundColor2(theme->getColor(ThemeColorId::TEXT_OUTLINE, 255)), @@ -408,7 +408,7 @@ bool Gui::handleKeyInput() #ifdef USE_SDL2 if (!keyInput.getText().empty()) eventToGlobalKeyListeners.setText(keyInput.getText()); -#endif +#endif // USE_SDL2 distributeKeyEventToGlobalKeyListeners( eventToGlobalKeyListeners); @@ -434,7 +434,7 @@ bool Gui::handleKeyInput() #ifdef USE_SDL2 if (!keyInput.getText().empty()) event.setText(keyInput.getText()); -#endif +#endif // USE_SDL2 if (!mFocusHandler->getFocused()->isFocusable()) mFocusHandler->focusNone(); @@ -511,7 +511,8 @@ void Gui::draw() const int posY = mouseY - (image->mBounds.h / 2); mGraphics->drawImage(image, posX, posY); } -#endif +#endif // DYECMD + Image *const mouseCursor = mMouseCursors->get( CAST_SIZE(mCursorType)); if (mouseCursor) @@ -927,7 +928,8 @@ void Gui::distributeMouseEvent(Widget *const source, #ifndef DYECMD if (type == MouseEventType::RELEASED) dragDrop.clear(); -#endif +#endif // DYECMD + if (!widget || event.isConsumed()) break; @@ -1005,8 +1007,9 @@ void Gui::handleMouseInput() #ifndef USE_SDL2 SDL_WarpMouse(mLastMouseX, mLastMouseY, mLastMouseRealX, mLastMouseRealY); -#endif -#endif +#endif // USE_SDL2 +#endif // ANDROID + mMouseInactivityTimer = 0; continue; } @@ -1018,7 +1021,8 @@ void Gui::handleMouseInput() #ifdef ANDROID mLastMouseRealX = mouseInput.getRealX(); mLastMouseRealY = mouseInput.getRealY(); -#endif +#endif // ANDROID + switch (mouseInput.getType()) { case MouseEventType::PRESSED: diff --git a/src/gui/gui.h b/src/gui/gui.h index bbeced8d2..258262b3f 100644 --- a/src/gui/gui.h +++ b/src/gui/gui.h @@ -95,9 +95,9 @@ class Window; #ifdef USE_SDL2 #define MouseStateType uint32_t -#else +#else // USE_SDL2 #define MouseStateType uint8_t -#endif +#endif // USE_SDL2 /** * \defgroup GUI Core GUI related classes (widgets) @@ -523,7 +523,8 @@ class Gui final #ifdef ANDROID uint16_t mLastMouseRealX; uint16_t mLastMouseRealY; -#endif +#endif // ANDROID + typedef std::list FocusListenerList; typedef FocusListenerList::iterator FocusListenerIterator; FocusListenerList mFocusListeners; diff --git a/src/gui/models/modelistmodel.cpp b/src/gui/models/modelistmodel.cpp index 75959cf12..5c63cf15e 100644 --- a/src/gui/models/modelistmodel.cpp +++ b/src/gui/models/modelistmodel.cpp @@ -51,7 +51,7 @@ static bool modeSorter(const std::string &mode1, const std::string &mode2) return false; } -#endif +#endif // ANDROID ModeListModel::ModeListModel() : mVideoModes() @@ -69,7 +69,7 @@ ModeListModel::ModeListModel() : std::sort(mVideoModes.begin(), mVideoModes.end(), &modeSorter); mVideoModes.push_back("custom"); -#endif +#endif // ANDROID } #ifndef ANDROID @@ -85,7 +85,7 @@ void ModeListModel::addCustomMode(const std::string &mode) } mVideoModes.push_back(mode); } -#endif +#endif // ANDROID int ModeListModel::getIndexOf(const std::string &widthXHeightMode) { diff --git a/src/gui/models/modelistmodel.h b/src/gui/models/modelistmodel.h index 9e5339a3d..4bdd29417 100644 --- a/src/gui/models/modelistmodel.h +++ b/src/gui/models/modelistmodel.h @@ -61,7 +61,7 @@ class ModeListModel final : public ListModel private: #ifndef ANDROID void addCustomMode(const std::string &mode); -#endif +#endif // ANDROID StringVect mVideoModes; }; diff --git a/src/gui/models/typelistmodel.h b/src/gui/models/typelistmodel.h index 6d96568c7..11f32ddeb 100644 --- a/src/gui/models/typelistmodel.h +++ b/src/gui/models/typelistmodel.h @@ -39,9 +39,9 @@ class TypeListModel final : public ListModel int getNumberOfElements() override final A_WARN_UNUSED #if defined(TMWA_SUPPORT) { return 3; } -#else +#else // defined(TMWA_SUPPORT) { return 2; } -#endif +#endif // defined(TMWA_SUPPORT) /** * Used to get an element from the list diff --git a/src/gui/popupmanager.cpp b/src/gui/popupmanager.cpp index ff9122fb1..0cab27cd8 100644 --- a/src/gui/popupmanager.cpp +++ b/src/gui/popupmanager.cpp @@ -45,7 +45,7 @@ void PopupManager::closePopupMenu() #ifndef DYECMD if (popupMenu) popupMenu->handleLink("cancel", nullptr); -#endif +#endif // DYECMD } void PopupManager::hideBeingPopup() @@ -53,7 +53,7 @@ void PopupManager::hideBeingPopup() #ifndef DYECMD if (beingPopup) beingPopup->setVisible(Visible_false); -#endif +#endif // DYECMD } void PopupManager::hideTextPopup() @@ -67,7 +67,7 @@ void PopupManager::hidePopupMenu() #ifndef DYECMD if (popupMenu) popupMenu->setVisible(Visible_false); -#endif +#endif // DYECMD } bool PopupManager::isPopupMenuVisible() @@ -76,7 +76,7 @@ bool PopupManager::isPopupMenuVisible() return popupMenu ? popupMenu->isPopupVisible() : false; #else return false; -#endif +#endif // DYECMD } void PopupManager::clearPopup() @@ -84,7 +84,7 @@ void PopupManager::clearPopup() #ifndef DYECMD if (popupMenu) popupMenu->clear(); -#endif +#endif // DYECMD } bool PopupManager::isTextPopupVisible() @@ -96,7 +96,7 @@ bool PopupManager::isBeingPopupVisible() { #ifndef DYECMD return beingPopup ? beingPopup->isPopupVisible() : false; -#else +#else // DYECMD return false; -#endif +#endif // DYECMD } diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp index 44432c4d5..a206f0c48 100644 --- a/src/gui/popups/beingpopup.cpp +++ b/src/gui/popups/beingpopup.cpp @@ -319,4 +319,4 @@ void BeingPopup::logic() logicChildren(); BLOCK_END("BeingPopup::logic") } -#endif +#endif // USE_PROFILER diff --git a/src/gui/popups/beingpopup.h b/src/gui/popups/beingpopup.h index 691b07f51..136a11d66 100644 --- a/src/gui/popups/beingpopup.h +++ b/src/gui/popups/beingpopup.h @@ -54,7 +54,7 @@ class BeingPopup final : public Popup #ifdef USE_PROFILER void logic(); -#endif +#endif // USE_PROFILER private: void addLabels(const int fontHeight); diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index 7532a9099..fae3c7251 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -76,7 +76,7 @@ #ifdef TMWA_SUPPORT #include "net/tmwa/guildmanager.h" -#endif +#endif // TMWA_SUPPORT #include "resources/chatobject.h" #include "resources/iteminfo.h" @@ -237,7 +237,7 @@ void PopupMenu::showPopup(const int x, const int y, const Being *const being) #ifdef TMWA_SUPPORT if (guild2->getServerGuild() || (guildManager && guildManager->havePower())) -#endif +#endif // TMWA_SUPPORT { mBrowserBox->addRow("/guild 'NAME'", // TRANSLATORS: popup menu item @@ -595,7 +595,7 @@ void PopupMenu::showPlayerPopup(const std::string &nick) #ifdef TMWA_SUPPORT if (guild2->getServerGuild() || (guildManager && guildManager->havePower())) -#endif +#endif // TMWA_SUPPORT { mBrowserBox->addRow("/kickguild 'NAME'", // TRANSLATORS: popup menu item @@ -615,7 +615,7 @@ void PopupMenu::showPlayerPopup(const std::string &nick) #ifdef TMWA_SUPPORT if (guild2->getServerGuild() || (guildManager && guildManager->havePower())) -#endif +#endif // TMWA_SUPPORT { // TRANSLATORS: popup menu item // TRANSLATORS: invite player to guild @@ -954,7 +954,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) #ifdef TMWA_SUPPORT if (guild2->getServerGuild() || (guildManager && guildManager->havePower())) -#endif +#endif // TMWA_SUPPORT { mBrowserBox->addRow("/kickguild 'NAME'", // TRANSLATORS: popup menu item @@ -975,7 +975,7 @@ void PopupMenu::showChatPopup(const int x, const int y, ChatTab *const tab) #ifdef TMWA_SUPPORT if (guild2->getServerGuild() || (guildManager && guildManager->havePower())) -#endif +#endif // TMWA_SUPPORT { mBrowserBox->addRow("/guild 'NAME'", // TRANSLATORS: popup menu item diff --git a/src/gui/sdlinput.cpp b/src/gui/sdlinput.cpp index 7ec7b7027..3ca69c820 100644 --- a/src/gui/sdlinput.cpp +++ b/src/gui/sdlinput.cpp @@ -165,7 +165,8 @@ void SDLInput::pushInput(const SDL_Event &event) mouseInput.setY(gui->getLastMouseY()); #ifdef ANDROID mouseInput.setReal(0, 0); -#endif +#endif // ANDROID + mouseInput.setButton(MouseButton::WHEEL); if (y > 0) mouseInput.setType(MouseEventType::WHEEL_MOVED_UP); @@ -177,14 +178,14 @@ void SDLInput::pushInput(const SDL_Event &event) break; } -#endif +#endif // USE_SDL2 #ifdef ANDROID #ifndef USE_SDL2 case SDL_ACCELEROMETER: break; -#endif -#endif +#endif // USE_SDL2 +#endif // ANDROID case SDL_MOUSEBUTTONDOWN: { @@ -197,11 +198,13 @@ void SDLInput::pushInput(const SDL_Event &event) #ifdef ANDROID #ifdef USE_SDL2 mouseInput.setReal(x, y); -#else +#else // USE_SDL2 + mouseInput.setReal(event.button.realx / scale, event.button.realy / scale); -#endif -#endif +#endif // USE_SDL2 +#endif // ANDROID + mouseInput.setButton(convertMouseButton(event.button.button)); #ifndef USE_SDL2 @@ -210,7 +213,7 @@ void SDLInput::pushInput(const SDL_Event &event) else if (event.button.button == SDL_BUTTON_WHEELUP) mouseInput.setType(MouseEventType::WHEEL_MOVED_UP); else -#endif +#endif // USE_SDL2 mouseInput.setType(MouseEventType::PRESSED); mouseInput.setTimeStamp(SDL_GetTicks()); mMouseInputQueue.push(mouseInput); @@ -227,11 +230,13 @@ void SDLInput::pushInput(const SDL_Event &event) #ifdef ANDROID #ifdef USE_SDL2 mouseInput.setReal(x, y); -#else +#else // USE_SDL2 + mouseInput.setReal(event.button.realx / scale, event.button.realy / scale); -#endif -#endif +#endif // USE_SDL2 +#endif // ANDROID + mouseInput.setButton(convertMouseButton(event.button.button)); mouseInput.setType(MouseEventType::RELEASED); mouseInput.setTimeStamp(SDL_GetTicks()); @@ -248,11 +253,13 @@ void SDLInput::pushInput(const SDL_Event &event) #ifdef ANDROID #ifdef USE_SDL2 mouseInput.setReal(x, y); -#else +#else // USE_SDL2 + mouseInput.setReal(event.motion.realx / scale, event.motion.realy / scale); -#endif -#endif +#endif // USE_SDL2 +#endif // ANDROID + mouseInput.setButton(MouseButton::EMPTY); mouseInput.setType(MouseEventType::MOVED); mouseInput.setTimeStamp(SDL_GetTicks()); @@ -282,7 +289,8 @@ void SDLInput::pushInput(const SDL_Event &event) if ((event.active.state & SDL_APPMOUSEFOCUS) && event.active.gain) mMouseInWindow = true; break; -#endif +#endif // USE_SDL2 + default: break; } // end switch @@ -311,7 +319,8 @@ MouseButtonT SDLInput::convertMouseButton(const int button) case SDL_BUTTON_WHEELUP: case SDL_BUTTON_WHEELDOWN: return MouseButton::EMPTY; -#endif +#endif // USE_SDL2 + default: // We have an unknown mouse type which is ignored. logger->log("unknown button type: %d", button); @@ -324,9 +333,10 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event) const SDL_keysym keysym = event.key.keysym; #ifdef USE_SDL2 int value = keysym.scancode; -#else +#else // USE_SDL2 + int value = keysym.unicode; -#endif +#endif // USE_SDL2 PRAGMA45(GCC diagnostic push) PRAGMA45(GCC diagnostic ignored "-Wswitch-enum") @@ -366,7 +376,7 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event) // is only valid on key down events in SDL. #ifndef USE_SDL2 if (event.type == SDL_KEYUP || keysym.unicode == ' ') -#endif +#endif // USE_SDL2 { value = KeyValue::SPACE; } @@ -374,7 +384,7 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event) case SDLK_ESCAPE: #ifdef USE_SDL2 case SDLK_AC_BACK: -#endif +#endif // USE_SDL2 value = KeyValue::ESCAPE; break; case SDLK_DELETE: @@ -465,7 +475,8 @@ int SDLInput::convertKeyCharacter(const SDL_Event &event) case SDLK_RSUPER: value = KeyValue::RIGHT_SUPER; break; -#endif +#endif // USE_SDL2 + case SDLK_MODE: value = KeyValue::ALT_GR; break; diff --git a/src/gui/setupactiondata.h b/src/gui/setupactiondata.h index 3753e00ee..ecf29470f 100644 --- a/src/gui/setupactiondata.h +++ b/src/gui/setupactiondata.h @@ -42,7 +42,7 @@ struct SetupActionData final { } A_DELETE_COPY(SetupActionData) -#endif +#endif // ADVGCC std::string name; const InputActionT actionId; diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp index 7aeeda6a8..a229cb10f 100644 --- a/src/gui/widgets/browserbox.cpp +++ b/src/gui/widgets/browserbox.cpp @@ -268,7 +268,8 @@ void BrowserBox::addRow(const std::string &row, const bool atTop) if (id) bLink.caption = ItemDB::get(id).getName(); } -#endif +#endif // DYECMD + if (translator) bLink.caption = translator->getStr(bLink.caption); } diff --git a/src/gui/widgets/inttextfield.cpp b/src/gui/widgets/inttextfield.cpp index e28aae7e2..5ac5ec38f 100644 --- a/src/gui/widgets/inttextfield.cpp +++ b/src/gui/widgets/inttextfield.cpp @@ -81,10 +81,11 @@ void IntTextField::keyPressed(KeyEvent &event) if (chr < '0' || chr > '9') return; } -#else +#else // USE_SDL2 + if (!event.getKey().isNumber()) return; -#endif +#endif // USE_SDL2 TextField::keyPressed(event); diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index db44a8a93..6ec9d73d7 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -841,10 +841,12 @@ void ScrollArea::mouseReleased(MouseEvent& event) #ifdef ANDROID int dx = mClickX - event.getX(); int dy = mClickY - event.getY(); -#else +#else // ANDROID + int dx = event.getX() - mClickX; int dy = event.getY() - mClickY; -#endif +#endif // ANDROID + if ((dx < 20 && dx > 0) || (dx > -20 && dx < 0)) dx = 0; diff --git a/src/gui/widgets/tabs/chat/chattab.cpp b/src/gui/widgets/tabs/chat/chattab.cpp index fad52cfb4..fccd428f4 100644 --- a/src/gui/widgets/tabs/chat/chattab.cpp +++ b/src/gui/widgets/tabs/chat/chattab.cpp @@ -52,7 +52,7 @@ #ifdef WIN32 #include -#endif +#endif // WIN32 #include diff --git a/src/gui/widgets/tabs/debugwindowtabs.cpp b/src/gui/widgets/tabs/debugwindowtabs.cpp index 2757d591c..4ee856ef4 100644 --- a/src/gui/widgets/tabs/debugwindowtabs.cpp +++ b/src/gui/widgets/tabs/debugwindowtabs.cpp @@ -36,7 +36,7 @@ #ifdef USE_OPENGL #include "resources/imagehelper.h" -#endif +#endif // USE_OPENGL #include "resources/map/map.h" @@ -75,12 +75,12 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : mDrawCallsLabel(new Label(this, strprintf("%s %s", // TRANSLATORS: debug window label _("Draw calls:"), "?"))), -#endif +#endif // DEBUG_DRAW_CALLS #ifdef DEBUG_BIND_TEXTURE mBindsLabel(new Label(this, strprintf("%s %s", // TRANSLATORS: debug window label _("Texture binds:"), "?"))), -#endif +#endif // DEBUG_BIND_TEXTURE // TRANSLATORS: debug window label, frames per second mFPSLabel(new Label(this, strprintf(_("%d FPS"), 0))), // TRANSLATORS: debug window label, logic per second @@ -125,10 +125,11 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : mFPSText = _("%d FPS (SDL2 default)"); break; }; -#else +#else // USE_OPENGL + // TRANSLATORS: debug window label mFPSText = _("%d FPS (Software)"); -#endif +#endif // USE_OPENGL place(0, 0, mFPSLabel, 2); place(0, 1, mLPSLabel, 2); @@ -144,22 +145,24 @@ MapDebugTab::MapDebugTab(const Widget2 *const widget) : #if defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) \ || defined(DEBUG_BIND_TEXTURE) int n = 10; -#endif +#endif // defined (DEBUG_OPENGL_LEAKS) || defined(DEBUG_DRAW_CALLS) + // || defined(DEBUG_BIND_TEXTURE) #ifdef DEBUG_OPENGL_LEAKS mTexturesLabel = new Label(this, strprintf("%s %s", // TRANSLATORS: debug window label _("Textures count:"), "?")); place(0, n, mTexturesLabel, 2); n ++; -#endif +#endif // DEBUG_OPENGL_LEAKS #ifdef DEBUG_DRAW_CALLS place(0, n, mDrawCallsLabel, 2); n ++; -#endif +#endif // DEBUG_DRAW_CALLS #ifdef DEBUG_BIND_TEXTURE place(0, n, mBindsLabel, 2); -#endif -#endif +#endif // DEBUG_BIND_TEXTURE +#endif // USE_OPENGL + place.getCell().matchColWidth(0, 0); place = h.getPlacer(0, 1); setDimension(Rect(0, 0, 600, 300)); @@ -221,7 +224,7 @@ void MapDebugTab::logic() mTexturesLabel->setCaption(strprintf("%s %d", // TRANSLATORS: debug window label _("Textures count:"), textures_count)); -#endif +#endif // DEBUG_OPENGL_LEAKS #ifdef DEBUG_DRAW_CALLS if (mainGraphics) { @@ -229,7 +232,7 @@ void MapDebugTab::logic() // TRANSLATORS: debug window label _("Draw calls:"), mainGraphics->getDrawCalls())); } -#endif +#endif // DEBUG_DRAW_CALLS #ifdef DEBUG_BIND_TEXTURE if (mainGraphics) { @@ -237,8 +240,8 @@ void MapDebugTab::logic() // TRANSLATORS: debug window label _("Texture binds:"), mainGraphics->getBinds())); } -#endif -#endif +#endif // DEBUG_BIND_TEXTURE +#endif // USE_OPENGL } } else diff --git a/src/gui/widgets/tabs/debugwindowtabs.h b/src/gui/widgets/tabs/debugwindowtabs.h index 044a2884c..a526d71f3 100644 --- a/src/gui/widgets/tabs/debugwindowtabs.h +++ b/src/gui/widgets/tabs/debugwindowtabs.h @@ -71,10 +71,11 @@ class MapDebugTab final : public DebugTab time_t mUpdateTime; #ifdef DEBUG_DRAW_CALLS Label *mDrawCallsLabel A_NONNULLPOINTER; -#endif +#endif // DEBUG_DRAW_CALLS #ifdef DEBUG_BIND_TEXTURE Label *mBindsLabel A_NONNULLPOINTER; -#endif +#endif // DEBUG_BIND_TEXTURE + Label *mFPSLabel A_NONNULLPOINTER; Label *mLPSLabel A_NONNULLPOINTER; std::string mFPSText; diff --git a/src/gui/widgets/tabs/setup_audio.cpp b/src/gui/widgets/tabs/setup_audio.cpp index af23ad2fe..f4b9534df 100644 --- a/src/gui/widgets/tabs/setup_audio.cpp +++ b/src/gui/widgets/tabs/setup_audio.cpp @@ -158,7 +158,7 @@ Setup_Audio::Setup_Audio(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Enable mumble voice chat"), "", "enableMumble", this, "enableMumbleEvent"); -#endif +#endif // USE_MUMBLE // TRANSLATORS: settings option new SetupItemCheckBox(_("Download music"), "", diff --git a/src/gui/widgets/tabs/setup_other.cpp b/src/gui/widgets/tabs/setup_other.cpp index 186e76fc2..4008a42af 100644 --- a/src/gui/widgets/tabs/setup_other.cpp +++ b/src/gui/widgets/tabs/setup_other.cpp @@ -415,7 +415,7 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Use FBO for screenshots (only for opengl)"), "", "usefbo", this, "usefboEvent"); -#endif +#endif // ANDROID #ifndef WIN32 // TRANSLATORS: settings option @@ -423,7 +423,7 @@ Setup_Other::Setup_Other(const Widget2 *const widget) : "screenshotDirectory3", this, "screenshotDirectory3Event", MainConfig_true, UseBase64_true); -#endif +#endif // WIN32 // TRANSLATORS: settings option new SetupItemIntTextField(_("Network delay between sub servers"), diff --git a/src/gui/widgets/tabs/setup_perfomance.cpp b/src/gui/widgets/tabs/setup_perfomance.cpp index 25f25a4c7..a55d264f0 100644 --- a/src/gui/widgets/tabs/setup_perfomance.cpp +++ b/src/gui/widgets/tabs/setup_perfomance.cpp @@ -78,7 +78,7 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Enable map reduce (Software)"), "", "enableMapReduce", this, "enableMapReduceEvent"); -#endif +#endif // USE_SDL2 // TRANSLATORS: settings option new SetupItemCheckBox(_("Enable compound sprite delay (Software)"), "", @@ -127,7 +127,7 @@ Setup_Perfomance::Setup_Perfomance(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Disable beings caching (Software)"), "", "disableBeingCaching", this, "disableBeingCachingEvent"); -#endif +#endif // USE_SDL2 // TRANSLATORS: settings group new SetupItemLabel(_("Different options (enable or disable can " diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 3797884a3..85927cd0e 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -48,11 +48,11 @@ #if defined(ANDROID) || defined(__APPLE__) || !defined(USE_OPENGL) #include "configuration.h" -#endif +#endif // defined(ANDROID) || defined(__APPLE__) || !defined(USE_OPENGL) #if defined(ANDROID) || defined(__APPLE__) #include "utils/stringutils.h" -#endif +#endif // defined(ANDROID) || defined(__APPLE__) #include "gui/models/modelistmodel.h" #include "gui/models/opengllistmodel.h" @@ -86,7 +86,8 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : #if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__) // TRANSLATORS: video settings button mDetectButton(new Button(this, _("Detect best mode"), "detect", this)), -#endif +#endif // !defined(ANDROID) && !defined(__APPLE__) && + // !defined(__native_client__) mDialog(nullptr), mCustomCursorEnabled(config.getBoolValue("customcursor")), mEnableResize(config.getBoolValue("enableresize")), @@ -95,11 +96,11 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : #ifdef ANDROID // TRANSLATORS: video settings checkbox _("Show cursor"), -#else +#else // ANDROID // TRANSLATORS: video settings checkbox _("Custom cursor"), -#endif - mCustomCursorEnabled)), +#endif // ANDROID + mCustomCursorEnabled)), // TRANSLATORS: video settings checkbox mEnableResizeCheckBox(new CheckBox(this, _("Enable resize"), mEnableResize)), @@ -179,13 +180,15 @@ Setup_Video::Setup_Video(const Widget2 *const widget) : #if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__) place(0, 8, mDetectButton); -#else +#else // !defined(ANDROID) && !defined(__APPLE__) && + // !defined(__native_client__) mNoFrameCheckBox->setEnabled(false); mEnableResizeCheckBox->setEnabled(false); #ifndef __native_client__ mFsCheckBox->setEnabled(false); #endif // __native_client__ -#endif +#endif // !defined(ANDROID) && !defined(__APPLE__) && + // !defined(__native_client__) int width = 600; @@ -220,7 +223,7 @@ void Setup_Video::apply() // checks for opengl usage if (intToRenderType(config.getIntValue("opengl")) == RENDER_SOFTWARE) { -#endif +#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) if (!WindowManager::setFullScreen(fullscreen)) { fullscreen = !fullscreen; @@ -261,7 +264,8 @@ void Setup_Video::apply() nullptr, 260); } -#endif +#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) + config.setValue("screen", fullscreen); } @@ -425,10 +429,11 @@ void Setup_Video::action(const ActionEvent &event) 260); } } -#else +#else // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) + mainGraphics->setWindowSize(width, height); WindowManager::doResizeVideo(width, height, false); -#endif +#endif // defined(WIN32) || defined(__APPLE__) || defined(ANDROID) } config.setValue("oldscreen", config.getBoolValue("screen")); @@ -501,5 +506,5 @@ void Setup_Video::action(const ActionEvent &event) delete test; } } -#endif +#endif // defined(USE_OPENGL) && !defined(ANDROID) && !defined(__APPLE__) } diff --git a/src/gui/widgets/tabs/setup_video.h b/src/gui/widgets/tabs/setup_video.h index e1a94557e..5cc519315 100644 --- a/src/gui/widgets/tabs/setup_video.h +++ b/src/gui/widgets/tabs/setup_video.h @@ -70,7 +70,8 @@ class Setup_Video final : public SetupTab, Label *mAltFpsLabel; #if !defined(ANDROID) && !defined(__APPLE__) && !defined(__native_client__) Button *mDetectButton; -#endif +#endif // !defined(ANDROID) && !defined(__APPLE__) && + // !defined(__native_client__) TextDialog *mDialog; bool mCustomCursorEnabled; bool mEnableResize; diff --git a/src/gui/widgets/tabs/setup_visual.cpp b/src/gui/widgets/tabs/setup_visual.cpp index 6cb00ad17..a8b783af2 100644 --- a/src/gui/widgets/tabs/setup_visual.cpp +++ b/src/gui/widgets/tabs/setup_visual.cpp @@ -133,7 +133,7 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Grab mouse and keyboard input"), "", "grabinput", this, "grabinputEvent"); -#endif +#endif // ANDROID // TRANSLATORS: settings option new SetupItemCheckBox(_("Blurring textures (OpenGL)"), @@ -211,7 +211,7 @@ Setup_Visual::Setup_Visual(const Widget2 *const widget) : // TRANSLATORS: settings option new SetupItemCheckBox(_("Center game window"), "", "centerwindow", this, "centerwindowEvent"); -#endif +#endif // defined(WIN32) || defined(__APPLE__) // TRANSLATORS: settings option new SetupItemCheckBox(_("Allow screensaver to run"), @@ -244,5 +244,5 @@ void Setup_Visual::apply() WindowManager::applyGrabMode(); #ifndef WIN32 WindowManager::applyScale(); -#endif +#endif // WIN32 } diff --git a/src/gui/widgets/textfield.cpp b/src/gui/widgets/textfield.cpp index b80e21eeb..13fddb119 100644 --- a/src/gui/widgets/textfield.cpp +++ b/src/gui/widgets/textfield.cpp @@ -312,7 +312,8 @@ void TextField::keyPressed(KeyEvent &event) return; } bool consumed(false); -#else +#else // USE_SDL2 + if (val >= 32) { if (mNumeric) @@ -375,7 +376,7 @@ void TextField::keyPressed(KeyEvent &event) mLastEventPaste = 0; bool consumed(false); -#endif +#endif // USE_SDL2 const InputActionT action = event.getActionId(); if (!inputManager.isActionActive(InputAction::GUI_CTRL)) @@ -562,13 +563,15 @@ void TextField::handleCtrlKeys(const InputActionT action, bool &consumed) { #ifdef USE_SDL2 handlePaste(); -#else +#else // USE_SDL2 + // hack to prevent paste key sticking if (mLastEventPaste && mLastEventPaste > cur_time) break; handlePaste(); mLastEventPaste = cur_time + 2; -#endif +#endif // USE_SDL2 + consumed = true; break; } @@ -762,14 +765,15 @@ void TextField::mousePressed(MouseEvent &event) #ifdef ANDROID if (!WindowManager::isKeyboardVisible()) inputManager.executeAction(InputAction::SHOW_KEYBOARD); -#endif +#endif // ANDROID + event.consume(); if (event.getButton() == MouseButton::RIGHT) { #ifndef DYECMD if (popupMenu) popupMenu->showTextFieldPopup(this); -#endif +#endif // DYECMD } else if (event.getButton() == MouseButton::LEFT) { @@ -784,7 +788,7 @@ void TextField::focusGained(const Event &event A_UNUSED) #ifdef ANDROID if (!WindowManager::isKeyboardVisible()) inputManager.executeAction(InputAction::SHOW_KEYBOARD); -#endif +#endif // ANDROID } void TextField::focusLost(const Event &event A_UNUSED) diff --git a/src/gui/widgets/textfield.h b/src/gui/widgets/textfield.h index e5173b3f1..359d54971 100644 --- a/src/gui/widgets/textfield.h +++ b/src/gui/widgets/textfield.h @@ -181,9 +181,10 @@ class TextField notfinal : public Widget, #ifdef ANDROID void focusGained(const Event &event) override final; -#else +#else // ANDROID + void focusGained(const Event &event) override final A_CONST; -#endif +#endif // ANDROID void focusLost(const Event &event) override A_CONST; diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 55dfe166a..f0ae81f17 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -69,9 +69,9 @@ #include "configuration.h" #ifndef DYECMD #include "dragdrop.h" -#else +#else // DYECMD #include "resources/image/image.h" -#endif +#endif // DYECMD #include "soundmanager.h" #include "const/sound.h" @@ -247,7 +247,7 @@ Window::~Window() #ifndef DYECMD if (setupWindow) setupWindow->unregisterWindowForReset(this); -#endif +#endif // DYECMD client->windowRemoved(this); @@ -869,7 +869,7 @@ void Window::mousePressed(MouseEvent &event) popupMenu->showWindowPopup(this); } } -#endif +#endif // DYECMD } void Window::close() @@ -908,7 +908,7 @@ void Window::updateResizeHandler(MouseEvent &event) #ifndef DYECMD if (!dragDrop.isEmpty()) return; -#endif +#endif // DYECMD mResizeHandles = getResizeHandles(event); @@ -1481,4 +1481,4 @@ void Window::logic() logicChildren(); BLOCK_END("Window::logic") } -#endif +#endif // USE_PROFILER diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index 7aca70bd9..bc77264a2 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -578,7 +578,7 @@ class Window notfinal : public BasicContainer2, #ifdef USE_PROFILER virtual void logic(); -#endif +#endif // USE_PROFILER protected: bool canMove() const A_WARN_UNUSED; diff --git a/src/gui/widgets/windowcontainer.cpp b/src/gui/widgets/windowcontainer.cpp index b3f01d0fe..3a2f35dba 100644 --- a/src/gui/widgets/windowcontainer.cpp +++ b/src/gui/widgets/windowcontainer.cpp @@ -101,4 +101,4 @@ void WindowContainer::draw(Graphics *const graphics) Container::draw(graphics); BLOCK_END("WindowContainer::draw") } -#endif +#endif // USE_PROFILER diff --git a/src/gui/widgets/windowcontainer.h b/src/gui/widgets/windowcontainer.h index cc9b3c814..feb9d719c 100644 --- a/src/gui/widgets/windowcontainer.h +++ b/src/gui/widgets/windowcontainer.h @@ -56,7 +56,7 @@ class WindowContainer notfinal : public Container #ifdef USE_PROFILER void draw(Graphics *const graphics) override A_NONNULL(2); -#endif +#endif // UNITTESTS private: /** diff --git a/src/gui/windowmanager.cpp b/src/gui/windowmanager.cpp index 8da30d648..8b439e6de 100644 --- a/src/gui/windowmanager.cpp +++ b/src/gui/windowmanager.cpp @@ -67,20 +67,20 @@ #ifdef ANDROID #ifndef USE_SDL2 #include -#endif -#endif +#endif // USE_SDL2 +#endif // ANDROID #ifdef USE_SDL2 #include -#else +#else // USE_SDL2 #include -#endif +#endif // USE_SDL2 #include #ifdef WIN32 #include -#endif +#endif // WIN32 #include "debug.h" @@ -91,7 +91,8 @@ namespace SDL_Surface *mIcon(nullptr); #ifndef USE_SDL2 int mKeyboardHeight(0); -#endif +#endif // USE_SDL2 + bool mIsMinimized(false); bool mNewMessageFlag(false); } // namespace @@ -118,7 +119,8 @@ void WindowManager::createWindows() CREATEWIDGETV0(itemPopup, ItemPopup); CREATEWIDGETV0(spellPopup, SpellPopup); CREATEWIDGETV0(skillPopup, SkillPopup); -#endif +#endif // DYECMD + CREATEWIDGETV0(textPopup, TextPopup); } @@ -137,7 +139,8 @@ void WindowManager::deleteWindows() delete2(userPalette); delete2(spellManager) delete2(spellShortcut) -#endif +#endif // DYECMD + delete2(textPopup); } @@ -161,7 +164,7 @@ void WindowManager::initTitle() settings.windowCaption.c_str()); #ifndef WIN32 setIcon(); -#endif +#endif // WIN32 } void WindowManager::updateTitle() @@ -221,9 +224,10 @@ void WindowManager::doResizeVideo(const int actualWidth, #ifdef __native_client__ naclPostMessage("resize-window", strprintf("%d,%d", actualWidth, actualHeight)); -#else +#else // __native_client__ + resizeVideo(actualWidth, actualHeight, always); -#endif +#endif // __native_client__ } void WindowManager::resizeVideo(int actualWidth, @@ -262,7 +266,7 @@ void WindowManager::resizeVideo(int actualWidth, Game *const game = Game::instance(); if (game) game->videoResized(width, height); -#endif +#endif // DYECMD if (gui) gui->draw(); @@ -278,11 +282,12 @@ bool WindowManager::setFullScreen(const bool fs) naclPostMessage("set-fullscreen", fs ? "on" : "off"); return true; -#else +#else // __native_client__ + if (!mainGraphics) return false; return mainGraphics->setFullscreen(fs); -#endif +#endif // __native_client__ } void WindowManager::applyGrabMode() @@ -312,7 +317,7 @@ void WindowManager::applyKeyRepeat() #ifndef USE_SDL2 SDL_EnableKeyRepeat(config.getIntValue("repeateDelay"), config.getIntValue("repeateInterval")); -#endif +#endif // USE_SDL2 } void WindowManager::applyScale() @@ -353,9 +358,11 @@ void WindowManager::setIcon() std::string iconFile = branding.getValue("appIcon", "icons/manaplus"); #ifdef WIN32 iconFile.append(".ico"); -#else +#else // WIN32 + iconFile.append(".png"); -#endif +#endif // WIN32 + iconFile = Files::getPath(iconFile); logger->log("Loading icon from file: %s", iconFile.c_str()); @@ -376,27 +383,31 @@ void WindowManager::setIcon() } if (icon) SetClassLong(pInfo.window, GCL_HICON, reinterpret_cast(icon)); -#else +#else // WIN32 + mIcon = MIMG_Load(iconFile.c_str()); if (mIcon) { #ifdef USE_SDL2 SDL_SetSurfaceAlphaMod(mIcon, SDL_ALPHA_OPAQUE); -#else +#else // USE_SDL2 + SDL_SetAlpha(mIcon, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); -#endif +#endif // USE_SDL2 + SDL::SetWindowIcon(mainGraphics->getWindow(), mIcon); } -#endif +#endif // WIN32 } bool WindowManager::isKeyboardVisible() { #ifdef USE_SDL2 return SDL_IsTextInputActive(); -#else +#else // USE_SDL2 + return mKeyboardHeight > 1; -#endif +#endif // USE_SDL2 } bool WindowManager::getIsMinimized() @@ -409,7 +420,7 @@ void WindowManager::updateScreenKeyboard(const int height) { mKeyboardHeight = height; } -#endif +#endif // USE_SDL2 void WindowManager::deleteIcon() { diff --git a/src/gui/windowmanager.h b/src/gui/windowmanager.h index 74fe1c2f1..8ddddfcd4 100644 --- a/src/gui/windowmanager.h +++ b/src/gui/windowmanager.h @@ -63,7 +63,7 @@ namespace WindowManager #ifndef USE_SDL2 void updateScreenKeyboard(const int height); -#endif +#endif // USE_SDL2 void reloadWallpaper(); diff --git a/src/gui/windowmanager_unittest.cc b/src/gui/windowmanager_unittest.cc index b098b865e..2305b0424 100644 --- a/src/gui/windowmanager_unittest.cc +++ b/src/gui/windowmanager_unittest.cc @@ -145,9 +145,11 @@ TEST_CASE("Windows tests", "windowmanager") SDLImageHelper::setRenderer(graphicsManager.createRenderer( graphicsManager.createWindow(640, 480, 0, SDL_WINDOW_SHOWN | SDL_SWSURFACE), SDL_RENDERER_SOFTWARE)); -#else +#else // USE_SDL2 + graphicsManager.createWindow(640, 480, 0, SDL_ANYFORMAT | SDL_SWSURFACE); -#endif +#endif // USE_SDL2 + ActorSprite::load(); userPalette = new UserPalette; theme = new Theme; diff --git a/src/gui/windowmenu.cpp b/src/gui/windowmenu.cpp index 789e8fce2..20577b6ff 100644 --- a/src/gui/windowmenu.cpp +++ b/src/gui/windowmenu.cpp @@ -89,9 +89,10 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : _("Chat"), x, h, InputAction::WINDOW_CHAT, #ifdef ANDROID Visible_true); -#else +#else // ANDROID Visible_false); -#endif +#endif // ANDROID + // TRANSLATORS: short button name for status window. addButton(N_("STA"), // TRANSLATORS: long button name for status window. @@ -175,9 +176,10 @@ WindowMenu::WindowMenu(const Widget2 *const widget) : _("Debug"), x, h, InputAction::WINDOW_DEBUG, #ifdef ANDROID Visible_true); -#else +#else // ANDROID Visible_false); -#endif +#endif // ANDROID + // TRANSLATORS: short button name for windows list menu. addButton(N_("WIN"), // TRANSLATORS: long button name for windows list menu. @@ -471,4 +473,4 @@ void WindowMenu::logicChildren() BasicContainer::logicChildren(); BLOCK_END("WindowMenu::logicChildren") } -#endif +#endif // USE_PROFILER diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index cf9d701f7..cc70bd55d 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -84,7 +84,7 @@ class WindowMenu final : public Container, #ifdef USE_PROFILER void logicChildren(); -#endif +#endif // USE_PROFILER protected: void drawChildren(Graphics *const graphics) override final diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index ec321a15f..8da750d34 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -267,7 +267,7 @@ void BuyDialog::init() if (mAdvanced && ( #ifdef TMWA_SUPPORT mNpcId == fromInt(Nick, BeingId) || -#endif +#endif // TMWA_SUPPORT mNpcId == fromInt(Cash, BeingId))) { mAdvanced = false; diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 1b33eab2f..d7392acc6 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -140,13 +140,15 @@ ChatWindow::ChatWindow() : setDefaultSize(w, 90, ImagePosition::UPPER_LEFT, -110, -35); else setDefaultSize(w, 123, ImagePosition::UPPER_LEFT, -110, -35); -#else +#else // ANDROID + if (mainGraphics->getWidth() < 600) w = mainGraphics->getWidth() - 10; if (w < 100) w = 100; setDefaultSize(w, 123, ImagePosition::LOWER_LEFT); -#endif +#endif // ANDROID + setMinWidth(150); setMinHeight(90); @@ -2080,7 +2082,7 @@ void ChatWindow::logicChildren() BasicContainer::logicChildren(); BLOCK_END("ChatWindow::logicChildren") } -#endif +#endif // USE_PROFILER void ChatWindow::addGlobalMessage(const std::string &line) { diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index 78d87eb6d..26ef6d0bb 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -310,7 +310,7 @@ class ChatWindow final : public Window, #ifdef USE_PROFILER void logicChildren(); -#endif +#endif // USE_PROFILER protected: friend class ChannelTab; diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp index 2c9a5c3f6..2a13511f1 100644 --- a/src/gui/windows/debugwindow.cpp +++ b/src/gui/windows/debugwindow.cpp @@ -170,4 +170,4 @@ void DebugWindow::logicChildren() BasicContainer::logicChildren(); BLOCK_END("DebugWindow::logicChildren") } -#endif +#endif // USE_PROFILER diff --git a/src/gui/windows/debugwindow.h b/src/gui/windows/debugwindow.h index 12bb97f13..af4d0732e 100644 --- a/src/gui/windows/debugwindow.h +++ b/src/gui/windows/debugwindow.h @@ -64,7 +64,7 @@ class DebugWindow final : public Window #ifdef USE_PROFILER void logicChildren(); -#endif +#endif // USE_PROFILER private: TabbedArea *mTabs A_NONNULLPOINTER; diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 8f65bb8f5..2291c9028 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -242,14 +242,16 @@ void EditServerDialog::action(const ActionEvent &event) case 2: mServer.type = ServerType::EVOL2; break; -#else +#else // TMWA_SUPPORT + case 0: mServer.type = ServerType::EATHENA; break; case 1: mServer.type = ServerType::EVOL2; break; -#endif +#endif // TMWA_SUPPORT + default: mServer.type = ServerType::UNKNOWN; break; diff --git a/src/gui/windows/itemamountwindow.h b/src/gui/windows/itemamountwindow.h index a89bb83f5..a728e824c 100644 --- a/src/gui/windows/itemamountwindow.h +++ b/src/gui/windows/itemamountwindow.h @@ -87,7 +87,7 @@ class ItemAmountWindow final : public Window, #ifndef UNITTESTS private: -#endif +#endif // UNITTESTS static void finish(Item *const item, const int amount, const int price, diff --git a/src/gui/windows/killstats.cpp b/src/gui/windows/killstats.cpp index 68b57b077..13c1dbbc4 100644 --- a/src/gui/windows/killstats.cpp +++ b/src/gui/windows/killstats.cpp @@ -38,7 +38,7 @@ #ifdef WIN32 #include -#endif +#endif // WIN32 #include "debug.h" diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index 9ef745cc3..4d58bf968 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -180,9 +180,11 @@ void LoginDialog::postInit() setContentSize(310, h); #ifdef ANDROID setDefaultSize(310, h, ImagePosition::UPPER_CENTER, 0, 0); -#else +#else // ANDROID + setDefaultSize(310, h, ImagePosition::CENTER, 0, 0); -#endif +#endif // ANDROID + center(); loadWindowState(); reflowLayout(); diff --git a/src/gui/windows/ministatuswindow.cpp b/src/gui/windows/ministatuswindow.cpp index 0f3ea0a4d..4dc59e1cd 100644 --- a/src/gui/windows/ministatuswindow.cpp +++ b/src/gui/windows/ministatuswindow.cpp @@ -571,4 +571,4 @@ void MiniStatusWindow::logicChildren() BasicContainer::logicChildren(); BLOCK_END("MiniStatusWindow::logicChildren") } -#endif +#endif // USE_PROFILER diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h index 82fa059c7..400aeb126 100644 --- a/src/gui/windows/ministatuswindow.h +++ b/src/gui/windows/ministatuswindow.h @@ -102,7 +102,7 @@ class MiniStatusWindow final : public Window, #ifdef USE_PROFILER void logicChildren(); -#endif +#endif // USE_PROFILER private: bool isInBar(ProgressBar *bar, int x, int y) const; diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index 68de46288..3f6c18ff8 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -51,7 +51,7 @@ #ifdef WIN32 #undef ERROR -#endif +#endif // WIN32 static const int MAX_SERVERLIST = 15; @@ -62,9 +62,11 @@ static std::string serverTypeToString(const ServerTypeT type) case ServerType::TMWATHENA: #ifdef TMWA_SUPPORT return "TmwAthena"; -#else +#else // TMWA_SUPPORT + return ""; -#endif +#endif // TMWA_SUPPORT + case ServerType::EATHENA: return "eAthena"; case ServerType::EVOL2: diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index 1b9d0a94a..5121d531b 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -30,7 +30,7 @@ #include "gui/windows/tradewindow.h" #include "const/gui/chat.h" -#endif +#endif // TMWA_SUPPORT #include "gui/windows/editdialog.h" @@ -54,7 +54,7 @@ #ifdef TMWA_SUPPORT #include "actormanager.h" #include "soundmanager.h" -#endif +#endif // TMWA_SUPPORT #include "configuration.h" #include "settings.h" @@ -64,20 +64,20 @@ #ifdef TMWA_SUPPORT #include "being/playerrelations.h" #include "net/chathandler.h" -#endif +#endif // TMWA_SUPPORT #include "net/buyingstorehandler.h" #include "net/vendinghandler.h" #include "net/serverfeatures.h" #ifdef TMWA_SUPPORT #include "net/tradehandler.h" -#endif +#endif // TMWA_SUPPORT #include "utils/delete2.h" #include "utils/gettext.h" #ifdef TMWA_SUPPORT #include "resources/iteminfo.h" -#endif +#endif // TMWA_SUPPORT #include "resources/inventory/inventory.h" @@ -271,7 +271,7 @@ void ShopWindow::action(const ActionEvent &event) announce(mSellShopItems, SELL); } } -#endif +#endif // TMWA_SUPPORT else if (eventId == "delete") { if (isBuySelected) @@ -1071,7 +1071,7 @@ bool ShopWindow::findShopItem(const ShopItem *const shopItem, } return false; } -#endif +#endif // TMWA_SUPPORT int ShopWindow::sumAmount(const Item *const shopItem) { diff --git a/src/gui/windows/shopwindow.h b/src/gui/windows/shopwindow.h index 50d924a1f..502e5c526 100644 --- a/src/gui/windows/shopwindow.h +++ b/src/gui/windows/shopwindow.h @@ -140,8 +140,8 @@ class ShopWindow final : public Window, bool findShopItem(const ShopItem *const shopItem, const int mode) const A_WARN_UNUSED; +#endif // TMWA_SUPPORT -#endif static int sumAmount(const Item *const shopItem) A_WARN_UNUSED; bool isShopEmpty() const A_WARN_UNUSED; @@ -159,7 +159,8 @@ class ShopWindow final : public Window, private: #ifdef TMWA_SUPPORT void startTrade(); -#endif +#endif // TMWA_SUPPORT + void updateSelection(); void updateShopName(); diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp index 9d4b34b6d..5184b3e1d 100644 --- a/src/gui/windows/shortcutwindow.cpp +++ b/src/gui/windows/shortcutwindow.cpp @@ -264,4 +264,4 @@ void ShortcutWindow::logicChildren() BasicContainer::logicChildren(); BLOCK_END("ShortcutWindow::logicChildren") } -#endif +#endif // USE_PROFILER diff --git a/src/gui/windows/shortcutwindow.h b/src/gui/windows/shortcutwindow.h index 2e0d8ee83..69d97749f 100644 --- a/src/gui/windows/shortcutwindow.h +++ b/src/gui/windows/shortcutwindow.h @@ -78,7 +78,7 @@ class ShortcutWindow final : public Window #ifdef USE_PROFILER void logicChildren(); -#endif +#endif // USE_PROFILER private: ShortcutWindow(); diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index 498ffc827..5b465161a 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -41,7 +41,7 @@ #include "gui/widgets/tabs/socialguildtab2.h" #include "net/tmwa/guildmanager.h" -#endif +#endif // TMWA_SUPPORT #include "debug.h" @@ -313,9 +313,10 @@ void SocialWindow::action(const ActionEvent &event) guildHandler->inviteResponse(mGuildInvited, true); else guildManager->inviteResponse(true); -#else +#else // TMWA_SUPPORT + guildHandler->inviteResponse(mGuildInvited, true); -#endif +#endif // TMWA_SUPPORT } else if (eventId == "no") { @@ -332,9 +333,10 @@ void SocialWindow::action(const ActionEvent &event) guildHandler->inviteResponse(mGuildInvited, false); else guildManager->inviteResponse(false); -#else +#else // TMWA_SUPPORT + guildHandler->inviteResponse(mGuildInvited, false); -#endif +#endif // TMWA_SUPPORT } mGuildInvited = 0; @@ -657,4 +659,4 @@ void SocialWindow::logicChildren() BasicContainer::logicChildren(); BLOCK_END("SocialWindow::logicChildren") } -#endif +#endif // USE_PROFILER diff --git a/src/gui/windows/socialwindow.h b/src/gui/windows/socialwindow.h index ad60c9ca8..6c23fd292 100644 --- a/src/gui/windows/socialwindow.h +++ b/src/gui/windows/socialwindow.h @@ -131,7 +131,7 @@ class SocialWindow final : public Window, #ifdef USE_PROFILER void logicChildren(); -#endif +#endif // USE_PROFILER protected: friend class SocialTab; diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index 40405f3e8..f22009013 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -45,7 +45,7 @@ #ifdef TMWA_SUPPORT const unsigned int MAGIC_START_ID = 340; -#endif +#endif // TMWA_SUPPORT TextCommandEditor::TextCommandEditor(TextCommand *const command) : // TRANSLATORS: command editor name @@ -54,14 +54,14 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : #ifdef TMWA_SUPPORT mIsMagicCommand(command ? (command->getCommandType() == TextCommandType::Magic) : false), -#endif +#endif // TMWA_SUPPORT mCommand(command), #ifdef TMWA_SUPPORT // TRANSLATORS: command editor button mIsMagic(new RadioButton(this, _("magic"), "magic", mIsMagicCommand)), // TRANSLATORS: command editor button mIsOther(new RadioButton(this, _("other"), "magic", !mIsMagicCommand)), -#endif +#endif // TMWA_SUPPORT // TRANSLATORS: command editor label mSymbolLabel(new Label(this, _("Symbol:"))), mSymbolTextField(new TextField(this)), @@ -93,7 +93,7 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : // TRANSLATORS: command editor label mSchoolLvlLabel(new Label(this, _("School level:"))), mSchoolLvlField(new IntTextField(this, 0)), -#endif +#endif // TMWA_SUPPORT // TRANSLATORS: command editor button mCancelButton(new Button(this, _("Cancel"), "cancel", this)), // TRANSLATORS: command editor button @@ -129,7 +129,7 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : mSchoolLvlField->setRange(0, 5); mSchoolLvlField->setWidth(20); -#endif +#endif // TMWA_SUPPORT mTypeDropDown->setActionEventId("type"); mTypeDropDown->addActionListener(this); @@ -150,19 +150,13 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : showControls(Visible_true); else showControls(Visible_false); -#endif - mSymbolTextField->setText(command->getSymbol()); - mCommandTextField->setText(command->getCommand()); - mCommentTextField->setText(command->getComment()); - mTypeDropDown->setSelected(CAST_S32(command->getTargetType())); -#ifdef TMWA_SUPPORT mManaField->setValue(command->getMana()); mMagicLvlField->setValue(command->getBaseLvl()); mSchoolDropDown->setSelected(CAST_S32(command->getSchool()) - MAGIC_START_ID); mSchoolLvlField->setValue(command->getSchoolLvl()); -#endif +#endif // TMWA_SUPPORT } ContainerPlacer placer; @@ -198,7 +192,8 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : placer(0, 10, mSaveButton, 2).setPadding(3); placer(2, 10, mCancelButton, 2).setPadding(3); placer(4, 10, mDeleteButton, 2).setPadding(3); -#else +#else // TMWA_SUPPORT + placer(0, 0, mSymbolLabel, 2).setPadding(3); placer(2, 0, mSymbolTextField, 3).setPadding(3); placer(0, 1, mCommandLabel, 2).setPadding(3); @@ -216,7 +211,7 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : placer(0, 5, mSaveButton, 2).setPadding(3); placer(2, 5, mCancelButton, 2).setPadding(3); placer(4, 5, mDeleteButton, 2).setPadding(3); -#endif +#endif // TMWA_SUPPORT setWidth(w); setHeight(h); @@ -239,7 +234,7 @@ TextCommandEditor::~TextCommandEditor() delete2(mTargetTypeModel); #ifdef TMWA_SUPPORT delete2(mMagicSchoolModel); -#endif +#endif // TMWA_SUPPORT } void TextCommandEditor::action(const ActionEvent &event) @@ -270,7 +265,7 @@ void TextCommandEditor::action(const ActionEvent &event) mIsMagicCommand = false; showControls(Visible_false); } -#endif +#endif // TMWA_SUPPORT } #ifdef TMWA_SUPPORT @@ -285,7 +280,7 @@ void TextCommandEditor::showControls(const Visible show) mSchoolLvlLabel->setVisible(show); mSchoolLvlField->setVisible(show); } -#endif +#endif // TMWA_SUPPORT void TextCommandEditor::scheduleDelete() { @@ -302,7 +297,7 @@ void TextCommandEditor::save() mCommand->setCommandType(TextCommandType::Magic); else mCommand->setCommandType(TextCommandType::Text); -#endif +#endif // TMWA_SUPPORT mCommand->setSymbol(mSymbolTextField->getText()); mCommand->setCommand(mCommandTextField->getText()); @@ -317,7 +312,8 @@ void TextCommandEditor::save() mCommand->setSchool(static_cast( mSchoolDropDown->getSelected() + MAGIC_START_ID)); mCommand->setSchoolLvl(mSchoolLvlField->getValue()); -#endif +#endif // TMWA_SUPPORT + if (spellManager) spellManager->save(); } @@ -337,7 +333,8 @@ void TextCommandEditor::deleteCommand() mCommand->setBaseLvl(0); mCommand->setSchool(MagicSchool::SkillMagic); mCommand->setSchoolLvl(0); -#endif +#endif // TMWA_SUPPORT + if (spellManager) spellManager->save(); } diff --git a/src/gui/windows/textcommandeditor.h b/src/gui/windows/textcommandeditor.h index 07562320a..e651352c9 100644 --- a/src/gui/windows/textcommandeditor.h +++ b/src/gui/windows/textcommandeditor.h @@ -34,7 +34,8 @@ class IntTextField; class Label; #ifdef TMWA_SUPPORT class MagicSchoolModel; -#endif +#endif // TMWA_SUPPORT + class RadioButton; class TargetTypeModel; class TextCommand; @@ -65,7 +66,7 @@ class TextCommandEditor final : public Window, private: #ifdef TMWA_SUPPORT void showControls(const Visible show); -#endif +#endif // TMWA_SUPPORT void save(); @@ -73,12 +74,13 @@ class TextCommandEditor final : public Window, #ifdef TMWA_SUPPORT bool mIsMagicCommand; -#endif +#endif // TMWA_SUPPORT TextCommand* mCommand; #ifdef TMWA_SUPPORT RadioButton* mIsMagic A_NONNULLPOINTER; -#endif +#endif // TMWA_SUPPORT + RadioButton* mIsOther A_NONNULLPOINTER; Label* mSymbolLabel A_NONNULLPOINTER; TextField* mSymbolTextField A_NONNULLPOINTER; @@ -102,7 +104,8 @@ class TextCommandEditor final : public Window, DropDown* mSchoolDropDown A_NONNULLPOINTER; Label* mSchoolLvlLabel A_NONNULLPOINTER; IntTextField* mSchoolLvlField A_NONNULLPOINTER; -#endif +#endif // TMWA_SUPPORT + Button* mCancelButton A_NONNULLPOINTER; Button* mSaveButton A_NONNULLPOINTER; Button* mDeleteButton A_NONNULLPOINTER; diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index b2adf2be3..fed308094 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -464,10 +464,12 @@ void UpdaterWindow::loadPatch() #elif defined(WIN32) const std::string url = "windowsDownloadUrl"; const std::string text = "windowsDownloadUrl"; -#else +#else // defined(ANDROID) + const std::string url = "otherDownloadUrl"; const std::string text = "otherDownloadUrl"; -#endif +#endif // defined(ANDROID) + mBrowserBox->addRow(std::string(" ##1[@@").append( branding.getStringValue(url)).append("|").append( branding.getStringValue(text)).append("@@]"), true); diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index a138c3994..d07cb9f7d 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -29,7 +29,7 @@ #include "party.h" #ifdef TMWA_SUPPORT #include "settings.h" -#endif +#endif // TMWA_SUPPORT #include "gui/onlineplayer.h" #include "gui/popupmanager.h" @@ -51,7 +51,7 @@ #ifdef TMWA_SUPPORT #include "net/download.h" -#endif +#endif // TMWA_SUPPORT #include "net/packetlimiter.h" #include "net/playerhandler.h" #include "net/serverfeatures.h" @@ -61,17 +61,17 @@ #ifndef TMWA_SUPPORT #include -#endif +#endif // TMWA_SUPPORT #include "debug.h" #ifdef free #undef free -#endif +#endif // free #ifdef malloc #undef malloc -#endif +#endif // malloc WhoIsOnline *whoIsOnline = nullptr; @@ -603,7 +603,7 @@ int WhoIsOnline::downloadThread(void *ptr) wio->mDownloadStatus = UPDATE_ERROR; return 0; } -#endif +#endif // TMWA_SUPPORT void WhoIsOnline::download() { @@ -625,7 +625,7 @@ void WhoIsOnline::download() if (mThread == nullptr) mDownloadStatus = UPDATE_ERROR; } -#endif +#endif // TMWA_SUPPORT } void WhoIsOnline::logic() @@ -698,7 +698,8 @@ void WhoIsOnline::slowLogic() default: break; } -#endif +#endif // TMWA_SUPPORT + BLOCK_END("WhoIsOnline::slowLogic") } @@ -725,7 +726,7 @@ void WhoIsOnline::action(const ActionEvent &event) } } else -#endif +#endif // TMWA_SUPPORT { if (PacketLimiter::limitPackets(PacketType::PACKET_ONLINELIST)) { diff --git a/src/gui/windows/whoisonline.h b/src/gui/windows/whoisonline.h index 5233a17ad..b125bc655 100644 --- a/src/gui/windows/whoisonline.h +++ b/src/gui/windows/whoisonline.h @@ -63,7 +63,7 @@ class WhoIsOnline final : public Window, * Loads and display online list from the memory buffer. */ void loadWebList(); -#endif +#endif // TMWA_SUPPORT void loadList(const std::vector &list); @@ -118,7 +118,7 @@ class WhoIsOnline final : public Window, size_t size, size_t nmemb, FILE *restrict stream); -#endif +#endif // TMWA_SUPPORT const std::string prepareNick(const std::string &restrict nick, const int level, -- cgit v1.2.3-70-g09d2